By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,745 Members | 1,957 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,745 IT Pros & Developers. It's quick & easy.

Tagging a Text String to the Beginning of a File

P: 25
Through the help of this forum, I've been able to create an application which reads in a set of files to populate an Access database and then export the individual records of one of the tables to separate XML files. Now, ultimately, I'd like to "tag" the first line of the XML files with a canned InfoPath header string so that each XML file can be read as a separate InfoPath form in a Form Library. Since I'm using the ExportXML application object to write the XML files, I don't think I can write the "tag" at the same time. It seems to me that I'd need to re-write the XML file with the "tag" appended to the front of it. How would I go about doing that?

Thanks,
Gregg
May 8 '07 #1
Share this Question
Share on Google+
2 Replies


JConsulting
Expert 100+
P: 603
Through the help of this forum, I've been able to create an application which reads in a set of files to populate an Access database and then export the individual records of one of the tables to separate XML files. Now, ultimately, I'd like to "tag" the first line of the XML files with a canned InfoPath header string so that each XML file can be read as a separate InfoPath form in a Form Library. Since I'm using the ExportXML application object to write the XML files, I don't think I can write the "tag" at the same time. It seems to me that I'd need to re-write the XML file with the "tag" appended to the front of it. How would I go about doing that?

Thanks,
Gregg
How about a quick function?

Expand|Select|Wrap|Line Numbers
  1. Function AddTAG(FileIn As String, FileOut As String)
  2. Dim strTAG As String
  3. Dim strIn As String
  4. strTAG = "ABCXYZ"
  5. Open FileOut For Output As #2
  6.     Print #2, strTAG
  7. Open FileIn For Input As #1
  8.     Do Until EOF(1)
  9.         Line Input #1, strIn
  10.         Print #2, strIn
  11.     Loop
  12. Close #1
  13. Close #2
  14. End Function
  15.  
May 8 '07 #2

P: 25
Great! Thanks, that worked. I found out that I needed to keep the text of the header tag consistent with the template.xsn file that gets saved everytime, but after that, it worked just great.
May 21 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.