Diane has attended:
Excel VBA Introduction course
Excel VBA Intermediate course
Excel VBA Advanced course
Excel VBA advanced coursework
Hi Jens
I have just been going through the examples we worked on this week. There is one piece of code which upon reflection I am a little puzzled about. in the Huge Email wbook, sub SendLateEmails
the line of code (see pasted further below) translates (I believe) as
'if orderdate minus shippingdate then'
I believe I must have written this incorrectly. And should have 'if orderdate minus shipping date testdiff then' (although it doesn't error), I think I should have written something that tested the result from the date subtraction.
kind regards
If MyArr(lRowCounter, 21) - MyArr(lRowCounter, 20) Then '21 and 20 are my column numbers
Set Outmail = OutApp.createitem(olmailitem)
With Outmail
.To = MyArr(lRowCounter, 8) 'client email add is in col 8
.Bcc = MyArr(lRowCounter, 16)
.Subject = "I am sorry but order # " & MyArr(lRowCounter, 23) & " is late"
.body = "Dear " & MyArr(lRowCounter, 3) & vbNewLine & "I'm sorry"
'.send
.Display
'Application.SendKeys "%s" 'this displayand sendkeys will work around id security settings prevent sent
End With
Set Outmail = Nothing 'clear information about email just sent from memory.
End If
Next lRowCounter
End Sub
RE: Excel VBA advanced coursework
Hi Diane,
Thank you for the forum question and it is good to see that you are working with the VBA.
The code miss >10
If MyArr(lRowCounter, 21) - MyArr(lRowCounter, 20)>10 Then
to translate the line:
If there is more than 10 days between the shippingDate (MyArr(lRowCounter, 21)) and the orderDate (MyArr(lRowCounter, 21)) then send the email.
I hope this makes sense and this is the answer you need.
Kind regards
Jens Bonde
Microsoft Office Specialist Trainer
Tel: 0207 987 3777
STL - https://www.stl-training.co.uk
98%+ recommend us
London's leader with UK wide delivery in Microsoft Office training and management training to global brands, FTSE 100, SME's and the public sector