#1
|
|||
|
|||
Code to add email account
I'm using the below macro/code to convert a word doc to pdf then send it onto outlook. What I'd like is have the code set a specific account from which the email is sent.
Can anyone help? |
#2
|
|||
|
|||
Sub SendAsPDF()
Dim strFileName As String Dim objOutlook As Object Dim objMailItem As Object strFileName = Replace(ActiveDocument.FullName, ".docm", ".pdf") ActiveDocument.ExportAsFixedFormat OutputFileName:=strFileName, _ ExportFormat:=wdExportFormatPDF Set objOutlook = CreateObject("Outlook.Application") Set objMailItem = objOutlook.CreateItem(0) ' 0 = olMailItem With objMailItem .Subject = " Leaflet" .Body = "This email is sent from an account we use for sending messages only. So if you want to contact us please don't reply to this message, do so by following this link for details:" .To = "" .Attachments.Add strFileName .Display End With Kill strFileName Set objMailItem = Nothing Set objOutlook = Nothing End Sub |
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
VBA Code to forward an email when moved to a sub folder not in the default account's inbox | Shayes | Outlook | 0 | 09-18-2017 03:32 PM |
code to find account and sum up values | Brian13 | Excel Programming | 2 | 05-31-2017 09:26 AM |
Office 2016 insists on using my MSN email when replying instead of the account the email is on | pegasus416 | Outlook | 0 | 09-11-2016 08:41 AM |
Macro to change font in email, dependent on which email account is being used | gb82 | Outlook | 2 | 01-23-2016 01:54 AM |
Require assistance in writing code to login to webmail account. | saurabhlotankar | Excel Programming | 4 | 05-21-2015 10:47 AM |