Sending out emails from a spreadsheet

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
tomagogame
Newbie
Posts: 4
Joined: Wed Oct 17, 2007 1:16 am

Sending out emails from a spreadsheet

Post by tomagogame » Wed Oct 17, 2007 2:32 am

Hi,

I need a little help with the code below. Here's what it does.

Loops through an excel till it detects an empty cell

name is column 6
receipent's email is column 16
personalized body is column 12

for testing purposes, i dare not email out column 16, so i use dummy accounts there.

The script below runs well and sends out the first email, goes to row 2, excel's window focused, the a popup appears saying "' not appropriate" (note the single quote at the beginning).

Any idea?

Mine is still an evaluation copy, is sending out one email, it's limitation?

Regards,
David.

Code: Select all

Let>filename=C:\pvbv.xls

IfFileExists>filename
ExecuteFile>filename
WaitWindowOpen>Microsoft Excel*

'
' go to first cell
'
press ctrl
wait>1
press home
wait>1
Release ctrl

Let>r=1
Let>recordlen=5

'
' email purposes
'
'Let>SMTP_AUTH=1
Let>SMTP_PORT=26

'
' loop till empty cell
'
Repeat>recordlen

DDERequest>Excel,filename,R%r%C12,bvpvmsg,60
DDERequest>Excel,filename,R%r%C16,bvpvemail,60
DDERequest>Excel,filename,R%r%C6,bvpvname,60

Let>[email protected];[email protected]
Let>subject=PV BV Email For %bvpvname%
Let>body=bvpvmsg

SMTPSendMail>recipients,server,[email protected],David,subject,body,
'Message>Result of SendMail: %SMTP_RESULT%
Wait>5
SetFocus>Microsoft Excel*
WaitWindowOpen>Microsoft Excel*

press down
wait>0.5

DDERequest>Excel,filename,R%r%C1,record,60
Length>record,recordlen

Let>r=r+1
until>recordlen=2 'empty cell

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Wed Oct 17, 2007 7:48 am

Hi,

The problem is this line:

until>recordlen=2 'empty cell

Two things:
1. MacroScript doesn't support inline comments
2. the apostrophe (') character is a VBScript comment.

So the line should be:

Until>recordlen=2

If you want a comment, do:

//Emtpy Cell
Until>recordlen=2

There are no restrictions in the trial version beyond the 30 day limit.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

tomagogame
Newbie
Posts: 4
Joined: Wed Oct 17, 2007 1:16 am

Post by tomagogame » Wed Oct 17, 2007 8:16 am

That solves a lot of headache! i was deleting codes everywhere.

Because the colors is the same with comments, So i thought it's usable.

So if I want to comment a whole bunch of codes, what symbols do I use?

For instance, PHP uses /* & */

Thanks in advance!

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Wed Oct 17, 2007 8:19 am

Yes, you can use the same PHP syntax:

/*
comments
*/

See "Remark" in the help file.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

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