I'm fairly new and I'm having issues emailing/reading lines from a text. It seems to have something to do with the CRLF command because when I take it out of the code the email works and has the data, but I need the lines to be on separate lines. Any help would be greatly appreciated!
VBStart
Function CreateEmail(strRecipient, strSubject, strBody)
'Create OL App object
Set objOLApp = CreateObject("Outlook.Application")
If objOLApp is nothing then
MsgBox "Could not create OL App. Shutting Down"
Exit Function
End If
'Create a new mail item
Set objMsg = objOLApp.CreateItem(0)
If objMsg is nothing then
MsgBox "Could not create Mail Item. Shutting Down"
Exit Function
End If
'Set basic message parameters
objMsg.To = strRecipient
objMsg.Subject = strSubject
objMsg.Body = strBody
'Send the message
objMsg.Send
'Free up the space
Set objOLApp = Nothing
Set objMsg = Nothing
CreateEmail = "Success"
End Function
VBEnd
Let>strTo=[email protected]
Let>strSubj=Daily Sales
Let>body=
Let>k=1
Label>start
ReadLn>c:\misc.txt
If>line=##EOF##,finish
Let>body=%body%%CRLF%line%
Let>k=k+1
Goto>start
Label>finish
VBEval>CreateEmail("%strTo%","%strSubj%","%body%"),Answer
Issue with %CRLF%??
Moderators: JRL, Dorian (MJT support)
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
VBScript doesn't like physical breaks. You can do this to replace them with VBScript's vbCRLF variable
StringReplace>body,CRLF," & vbCRLF & ",body
VBEval>CreateEmail("%strTo%","%strSubj%","%body%"),Answer
StringReplace>body,CRLF," & vbCRLF & ",body
VBEval>CreateEmail("%strTo%","%strSubj%","%body%"),Answer
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
Hi jonesey10,
This may or may not help but I'll mention it anyway. I noticed near the end of your posted code above, you have this line:
This may or may not help but I'll mention it anyway. I noticed near the end of your posted code above, you have this line:
- Let>body=%body%%CRLF%line%
- Let>body=%body%%CRLF%%line%
jpuziano
Note: If anyone else on the planet would find the following useful...
[Open] PlayWav command that plays from embedded script data
...then please add your thoughts/support at the above post -
Note: If anyone else on the planet would find the following useful...
[Open] PlayWav command that plays from embedded script data
...then please add your thoughts/support at the above post -
