LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Modifying .txt file using Excel VBA

Hi there.

I am using excel VBA to launch another software using a journal file (which
is a text file). However, before I launch I sometimes want to modify some of
the information in the text file. I have written some VBA code to read the
original journal file and then printing a new text file at the same time.
When certain variables are read in I substitute the value that is printed in
the new file. This all works well and below is an example of my code.

Open filename For Input Access Read As #2
Open tempfile For Output As #3

While Not EOF(2)

Input #2, slask

If slask = "; Zero Shear Visc visc0" Then
Print #3, slask
Input #2, slask
Print #3, visc0_1
'Print #3, ";;;"
Input #2, slask
End If


If slask = "; Inf Shear Visc viscinf" Then
Print #3, slask
Input #2, slask
Print #3, viscinf1
Input #2, slask
End If

Print #3, slask
Wend

'Print #3, ";;;"
Close #2
Close #3

Name filename As filenamenew
Name tempfile As filename

I am very new at this so I am not really sure how the input and output
works, but I have found that using this method the new file that is printed
leaves out some vital characters such as ". I am reading in the word
"laminar" from the input file but the printed output reads laminar without
the ". Unfortunately I really need my " to be printed to the for the journal
file to work as it should. Any suggestions?

Thank you!
 
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
Password protecting file (modifying) with a slight twist Marc T Excel Discussion (Misc queries) 2 September 18th 08 05:30 PM
Modifying a Excel file without opening excel Jay Excel Discussion (Misc queries) 5 June 13th 08 11:48 AM
Large file sizes after modifying spreadsheet in Excel 2007. Artagel Excel Discussion (Misc queries) 3 April 5th 07 03:34 PM
reading and modifying file comments [email protected] Excel Programming 3 March 24th 06 06:41 PM
modifying a excel *.csv file problem J_J[_2_] Excel Programming 2 February 4th 06 01:55 PM


All times are GMT +1. The time now is 09:39 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"