Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

REading in entire file

Status
Not open for further replies.

aheu9

Programmer
Sep 7, 2006
17
US
What is the best way to read in an entire file without editing any characters. For example if I use a for loop until EOF it will input every string up to a space of newline, I want the spaces and the newlines intact. Is there an easy way to read in the entire file to a variable. I am using VBA 6.
Thanks in advance.
 
aheu9,
If your not using the File System Object you might look at the Input() function.

[tt]strFile = Input(LOF(filenumber),filenumber)[/tt]

Hope this helps,
CMP

[small]For the best results do what I'm thinking, not what I'm saying.[/small]
(GMT-07:00) Mountain Time (US & Canada)
 
Thank you for all the help, I ended up using the file system object, and used the ReadLine instead of ReadAll Method to avoid any future memory problems in a while loop using the AtEndOfStream property.
Thanks for all the help!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top