View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
[email protected] EagleOne@discussions.microsoft.com is offline
external usenet poster
 
Posts: 391
Default Possible to Transfer/Open "Read" a text file into VBA Module?

Rick,

Thanks for your time and knowledge!

'Kinda thought of the approach. I just wondered if there were alternate approaches.
Working on alt's to protect VBA code.


"Rick Rothstein" wrote:

Sorry, I meant to give you the code to read in the file...

Dim X As Long
Dim FileNum As Long
Dim TotalFile As String
....
....
FileNum = FreeFile
Open "C:\TEMP\TestData.txt" For Binary As #FileNum
TotalFile = Space(LOF(FileNum))
Get #FileNum, , TotalFile
Close #FileNum
'
' The TotalFile variable now contains the entire text from
' the file specified in the Open statement (obviously change
' the same file name and path to the one you want