Load text file contents as a string in Module 
Author Message
 Load text file contents as a string in Module

Hi

Can anyone tell me an easy way to load the contents of a small text file
into a string variable within an access module.

Thanks

Mark



Sun, 16 May 2004 01:29:32 GMT  
 Load text file contents as a string in Module
Function ReadInTxtFile(strFileName As String) As Variant
   Dim varText As Variant
   Open strFileName For Binary As #1
   varText = Input(LOF(1), #1)   'read whole file
   Close #1
   ReadInTxtFile = varText   'set return variable
End Function

Steve

Quote:

> Hi

> Can anyone tell me an easy way to load the contents of a small text file
> into a string variable within an access module.

> Thanks

> Mark



Sun, 16 May 2004 02:15:58 GMT  
 Load text file contents as a string in Module
Thanks that works a treat!

Function ReadInTxtFile(strFileName As String) As Variant
   Dim varText As Variant
   Open strFileName For Binary As #1
   varText = Input(LOF(1), #1)   'read whole file
   Close #1
   ReadInTxtFile = varText   'set return variable
End Function

Steve


Quote:
> Hi

> Can anyone tell me an easy way to load the contents of a small text file
> into a string variable within an access module.

> Thanks

> Mark



Sun, 16 May 2004 18:10:24 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. load contents of remote text file into variable

2. Looping through text file to load contents in listbox

3. Write contents of listbox to text file/populate listbox from text file

4. Populate Recipient filed with contents of text file

5. How can I use VBA to search all modules for a text string

6. Loading text files to text boxes

7. Loading a Text File into a VB3 Text Box

8. Loading large text files into a text box

9. Loading text into a string

10. Help parse a text string from sequential text file

11. Search for a text string in text file

12. How to replace text string in text file

 

 
Powered by phpBB® Forum Software