code obviate necessity click

Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

Forum home » Delegate support and help forum » Microsoft Excel VBA Training and help » Code to obviate necessity to click when sending a copy via outlo

Code to obviate necessity to click when sending a copy via outlo

resolvedResolved · High Priority · Version 2007

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

 

Training courses

 

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
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.


 

Excel tip:

Editing Formulas in Excel Cells

Although people like to edit a formula in the Formula bar, you can also edit a formula in the cell.

To do this select the cell and press "F2". This puts Excel into Edit mode, and you can move around in the cell and make any necessary changes.

Double-clicking the cell also puts Excel in Edit mode.

View all Excel hints and tips


Server loaded in 0.08 secs.