Compilation error :1006

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
jonesey10
Newbie
Posts: 8
Joined: Wed Mar 31, 2010 3:11 pm

Compilation error :1006

Post by jonesey10 » Mon Apr 19, 2010 6:45 pm

Can anyone help? This was working and all of a sudden I started getting a compilation error :1006 Expected ')' Line 2 Column 675.

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]
vbe>date()-1,mydate
Let>strSubj=US Retail Daily Comp Sales: %mydate%
Let>body=
Let>k=1
Label>start
ReadLn>G:Sales Update.txt,k,line
If>line=##EOF##,finish
Let>body=%body%%CRLF%%line%
Let>k=k+1
Goto>start
Label>finish
StringReplace>body,CRLF," & vbCRLF & ",body

VBEval>CreateEmail("%strTo%","%strSubj%","%body%"),Answer

jonesey10
Newbie
Posts: 8
Joined: Wed Mar 31, 2010 3:11 pm

Post by jonesey10 » Mon Apr 19, 2010 7:48 pm

Please disregard. Figured it out. There was a quote in the file that needs to be removed.

User avatar
JRL
Automation Wizard
Posts: 3505
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Mon Apr 19, 2010 7:58 pm

I saw your post and didn't know how to answer your question. But I am curious. Why use a VBScript email script rather than using the built in SMTPSendMail> Macro Scheduler function?

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts