98.7% Of all customers recommend us, we're so confident about our results we publish all reviews and stats
View Live Stats View ReviewsForum home » Delegate support and help forum » Microsoft Excel VBA Training and help » Excel VBA advanced coursework
Excel VBA advanced coursework
Resolved · Low Priority · Version 2016
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
Thu 11 Jul 2019: Automatically marked as resolved.
Training information:
Welcome. Please choose your application (eg. Excel) and then post your question. Our Microsoft Qualified trainers will then respond within 24 hours (working days). Frequently Asked Questions
Any suggestions, questions or comments? Please post in the Improve the forum thread. |
Excel tip:Number format shortcutCtrl+Shift+! applies the Number format, with two decimal places |