Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Manipulating text file data


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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 703
Default Manipulating text file data

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Manipulating text file data


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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 703
Default Manipulating text file data

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Manipulating ranges in a different file Lenchik Links and Linking in Excel 2 October 18th 08 04:01 AM
Manipulating ranges in a different excel file Lenchik Excel Worksheet Functions 3 October 13th 08 03:51 AM
Manipulating text of an equation achidsey Excel Programming 1 September 13th 05 12:04 PM
Manipulating a data file with some sort of Macro taldridg2 Excel Programming 1 September 18th 04 04:13 AM
Manipulating text - 2 queries Hotbird[_2_] Excel Programming 1 December 24th 03 02:12 AM


All times are GMT +1. The time now is 03:01 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"