Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Hi guys, I have a text file that I am working with that i would like to append data to sort of. </Placemark new information </Document </Folder </kml I would like to open the file move up between </Placemark and </Document and add some new data. I' having a hard time finding any info other than normal inputs or appends anyone have an idea? I'm sure its simple but im having a major block today, and its driving me nuts! All using VBA of course I need to get info from a dialog and write it to text not to a spreadsheet. -- Kingdbag ------------------------------------------------------------------------ Kingdbag's Profile: http://www.excelforum.com/member.php...o&userid=17900 View this thread: http://www.excelforum.com/showthread...hreadid=515914 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
As long as "</Placemark" occurs only once in the input file, and the new
information is simply one string, you could try something like Dim NewInformation As String NewInformation = "Whatever" Open "Your Input File" For Binary As #1 Open "Your Output File" For Binary As #2 Put #2, 1, Replace(Input(LOF(1), #1), "</Placemark", _ "</Placemark" & NewInformation) Close #1 Close #2 "Kingdbag" wrote: Hi guys, I have a text file that I am working with that i would like to append data to sort of. </Placemark new information </Document </Folder </kml I would like to open the file move up between </Placemark and </Document and add some new data. I' having a hard time finding any info other than normal inputs or appends anyone have an idea? I'm sure its simple but im having a major block today, and its driving me nuts! All using VBA of course I need to get info from a dialog and write it to text not to a spreadsheet. -- Kingdbag ------------------------------------------------------------------------ Kingdbag's Profile: http://www.excelforum.com/member.php...o&userid=17900 View this thread: http://www.excelforum.com/showthread...hreadid=515914 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() I had to modify it a tiny bit but it did what i was looking for thanks a ton I couldn't think of how to do it or find it on google for some reason. Dim NewInformation As String NewInformation = "test" Open "my file" _ For Binary As #1 Open "my file" _ For Binary As #2 Put #2, 1, Replace(Input(LOF(1), #1), "</Document", _ NewInformation & vbCrLf & "</Document") Close #1 Close #2 -- Kingdbag ------------------------------------------------------------------------ Kingdbag's Profile: http://www.excelforum.com/member.php...o&userid=17900 View this thread: http://www.excelforum.com/showthread...hreadid=515914 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Now you got it! I thought about the vbCrLf after I posted. Glad to help.
"Kingdbag" wrote: I had to modify it a tiny bit but it did what i was looking for thanks a ton I couldn't think of how to do it or find it on google for some reason. Dim NewInformation As String NewInformation = "test" Open "my file" _ For Binary As #1 Open "my file" _ For Binary As #2 Put #2, 1, Replace(Input(LOF(1), #1), "</Document", _ NewInformation & vbCrLf & "</Document") Close #1 Close #2 -- Kingdbag ------------------------------------------------------------------------ Kingdbag's Profile: http://www.excelforum.com/member.php...o&userid=17900 View this thread: http://www.excelforum.com/showthread...hreadid=515914 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Manipulating ranges in a different file | Links and Linking in Excel | |||
Manipulating ranges in a different excel file | Excel Worksheet Functions | |||
Manipulating text of an equation | Excel Programming | |||
Manipulating a data file with some sort of Macro | Excel Programming | |||
Manipulating text - 2 queries | Excel Programming |