Send e-mail with Lotus Notes as well as Outlook

crossblade

New Member
Joined
May 19, 2015
Messages
9
Hi everyone,

I had a requirement to send an attachment via outlook which I have included the code I am using for that below. What I now need to do is enable me to send the same via Lotus Notes if that is what the user uses. Also is there a good way to detect which mail system the user is using, then I could call different routines as appropriate.

Sub RenameThenSaveFile()

ChDir "C:\Users\Public"

ActiveWorkbook.SaveAs Filename:="C:\Users\Public\" & FileNameString & ".xlsm", _
FileFormat:=xlOpenXMLWorkbookMacroEnabled, CreateBackup:=False

MailWorkbookUsingOutlook

Range("A2").Select

End Sub


Sub MailWorkbookUsingOutlook()


Dim OutApp As Object
Dim OutMail As Object

Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)

On Error Resume Next
With OutMail
.To = "fred@fred.com" 'AddressToSendEmailTo
.CC = ""
.BCC = ""
.Subject = FileNameString
.Body = FileNameString
.Attachments.Add ActiveWorkbook.FullName
'You can add other files also like this
'.Attachments.Add ("C:\test.txt")
.Send 'or use .Display
End With
On Error GoTo 0

Set OutMail = Nothing
Set OutApp = Nothing

End Sub​


Thanks for looking.
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand

Forum statistics

Threads
1,203,242
Messages
6,054,349
Members
444,717
Latest member
melindanegron

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top