1

I'm trying to fix up a mailscript.

I pretty much need something like

cmBody = "c:\body.txt"

It's not that simple, but you get the idea.

The txt file is the content of the email.

I hope you guys can help me out.

2
  • Can you be more specific and detailed? you are running around the question... :$
    – bonCodigo
    Jan 21, 2013 at 12:21
  • Yeah, sorry. I want cmbody to contain the content of body.txt edit: I think I got it. I'll post the answer. Jan 21, 2013 at 12:27

2 Answers 2

2

You can do like this:

    Dim fso As Object
    Dim contents As String

    Set fso = CreateObject("Scripting.FileSystemObject")
    contents = fso.OpenTextFile("c:\temp\test.txt", ForReading).ReadAll()
1

I got it.

This is the code I ended up using. (If any of you even understood the question)

Open "C:\body.txt" For Input As #intFile
strFile = Input$(LOF(intFile), #intFile)
Close #intFile
cmBody = strFile

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.