![]() |
#1
|
|||
|
|||
![]()
I'm trying to write a Macro that takes a Word 2010 document and sends it in the body of an email to a set email distribution list by clicking a button on the document. I had everything working but only when I run the Macro on my computer and this will be a report that several people will fill out and will need to email. Then I upgraded to Office 2010 and now it won't even work on my PC.
Any help is appreciated! Here is my current code: Code:
Sub SendDocumentInMail() Dim bStarted As Boolean Dim oOutlookApp As Outlook.Application Dim oItem As Outlook.MailItem On Error Resume Next 'Get Outlook if it's running Set oOutlookApp = GetObject(, "Outlook.Application") If Err <> 0 Then 'Outlook wasn't running, start it from code Set oOutlookApp = CreateObject("Outlook.Application") bStarted = True End If 'Create a new mailitem Set oItem = oOutlookApp.CreateItem(olMailItem) With oItem 'Set the recipient for the new email .To = "IDS-Omaha-LeadNurseReport@xxxxx.com" 'Set the recipient for a copy .Subject = "Lead Nurse Report" 'The content of the document is used as the body for the email .Body = ActiveDocument.Content .Send End With If bStarted Then 'If we started Outlook from code, then close it oOutlookApp.Quit End If 'Clean up Set oItem = Nothing Set oOutlookApp = Nothing End Sub |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Macro to export email to text file on send depending on category | Joe Patrick | Outlook | 0 | 10-19-2012 06:20 PM |
![]() |
plamenbv | Excel Programming | 1 | 04-16-2012 05:25 AM |
![]() |
JSYdeJong | Outlook | 1 | 11-02-2011 07:22 PM |
Send document as email | pat-ty | Word | 0 | 09-09-2010 10:23 AM |
![]() |
helpplease | Outlook | 6 | 12-21-2008 06:00 AM |