John has attended:
Excel VBA Intro Intermediate course
Excel VBA Intro Intermediate course
Code to obviate necessity to click when sending a copy via outlo
How can I avaoid the need to click on 'approved' when sending an email via outlook.
RE: Code to obviate necessity to click when sending a copy via o
Hi John, thanks for your query. What you need is the "Sendkeys" keyword to mimic the user pressing "OK". Have a look at this tutorial:
http://www.tek-tips.com/faqs.cfm?fid=5037
...and particularly here where the Enter key is sent by code to a messagebox:
http://en.allexperts.com/q/Excel-1059/VBA-5.htm
There are other, more complicated, ways of doing this as I think I mentioned when we met but try Sendkeys out first and see how you get on.
Hope this helps,
Anthony
RE: Code to obviate necessity to click when sending a copy via o
Hi Anthony
This is the Sub Routine I am using:
Sub ApprovedForPayment()
'Sends the Workbook to 'pl@sussexdowns.ac.uk'
Dim Location As String
Location = Sheets("Payments").Range("$H$2")
Application.DisplayAlerts = False
ActiveWorkbook.SendMail "pl@sussexdowns.ac.uk", Subject:=Location & " Homestay Payments Approved for Payment"
Application.DisplayAlerts = True
End Sub
The process stops at the sendmail command and I am presented with the message that an aplication outside Outlook wants to send a message and option to 'Allow' or 'Deny' with the 'Deny' button as the default option. There is also a 'Help' button.
I can use 'Tab' key and 'Enter to 'Allow' but so far I have been unable to make the 'SendKeys' function work; when stepping throu the subroutine processing is halted until an option is selected.
Where am I going wrong?
I would be grateful for your help with this please.
John