I have a problem creating an email with excel vba. I wrote code and created an addin that works on my computer. I have Excel 2013 and Outlook 2013. The addin also works on excel 2010 with outlook 2010.
The problem I am having is some of the computers in our company have Office 2013 installed, and use Outlook 2010. Some of the mail servers we have do not support Outlook 2013 yet. Whenever I run the code on those computers, it tries to open the 2013 version of outlook instead of the 2010 version. I set Outlook 2010 as the default and it still does the same thing.
My question is, is there another way to write the code so it launches the 2010 version instead of the 2013?
Here is the code I have now that works great on my computer.
Thank you in advance for any help.
The problem I am having is some of the computers in our company have Office 2013 installed, and use Outlook 2010. Some of the mail servers we have do not support Outlook 2013 yet. Whenever I run the code on those computers, it tries to open the 2013 version of outlook instead of the 2010 version. I set Outlook 2010 as the default and it still does the same thing.
My question is, is there another way to write the code so it launches the 2010 version instead of the 2013?
Here is the code I have now that works great on my computer.
Code:
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 = EmailRecip
.Importance = 2
.CC = ""
.Subject = EmailSubject
.Body = EmailBody & vbNewLine & " "
.Attachments.Add ActiveWorkbook.FullName
.Display
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
Thank you in advance for any help.