Archive of Mr Excel Message Board
Does anybody know a way to use the ActiveWorkbook.SendMail method in Excel VBA to send the workbook via email with high priority? Otherwise, how would you include the current workbook as an attachment in a MAPI session (I believe you can send an MAPI email has high priority).
Thanx,
Shane T

You'll have to load in and use Outlook's object library to get where you want to go. eg, first, in your Excel Macro, add the libraries you'll need:
On Error Resume Next
'adding VBE object library:
ActiveWorkbook.VBProject.References.AddFromGuid "{0002E157-0000-0000-C000-000000000046}", 5, 0
'Adding outlook object library:
Application.VBE.ActiveVBProject.References.AddFromGuid "{00062FFF-0000-0000-C000-000000000046}", 8, 0
On Error GoTo 0
Then, start an Outlook session, eg...
Set myOlApp = CreateObject("Outlook.Application")
Set olMAPI = myOlApp.GetNamespace("MAPI")
Have the macro save your Excel file, create a mailitem, attach the saved file, define a priority, and send the mailitem.
For more guidance, look at Outlook's Send method, mailitem object, and mailitem's Importance property.
I think I've given you the main compass points. It shouldn't be too difficult to cobble together some code. Good Luck.
Tom

