Hi,
i want to open a txt file (could be quite large) and read all the txt from it so i can use my program to email it.. I have the emailing side sorted.. just need to work out how to open my file and send it as txt
Thanks!
Printable View
Hi,
i want to open a txt file (could be quite large) and read all the txt from it so i can use my program to email it.. I have the emailing side sorted.. just need to work out how to open my file and send it as txt
Thanks!
Here's a quick way of getting the entire file into a variable.
VB Code:
Option Explicit Private Sub Form_Load() Dim fileContents As String Open "c:\autoexec.bat" For Binary As #1 fileContents = Input(LOF(1), 1) Close #1 MsgBox fileContents End Sub
Instead of opening and reading the file, if you want to EMail the contents, wouldn't it be simpler to just programmatically attach the file to an EMail message?
i don't know how to do that with the code i have.. this is easier :-)