Hi All,

The following getStandardEmail Function has worked for years. The user makes sure Outlook is open first.

I design in 2010 and works fine for me. However when one of my users opens it in excel 2016, with Outlook 2016 already open, it fails.

When they run it it starts going through the wizard to add emails for the first time on the machine. Outlook 2016 is definitely open.

My question is how do I fix is so it works for 2010, 2013 & 2016

Thanks in Advance

Public Function getStandardEmail()
'purpose gets standard email wording into 2 global variables
'g_strHTMLFoot1 = Wording before you add required
'g_strHTMLFoot2 = Wording to be added after your wording
'

Dim OL As Outlook.Application
Dim olMsg As Outlook.MailItem
Dim strHTMLFoot As String
Dim strHTMLFoot1 As String
Dim strHTMLFoot2 As String
Dim lngBodypos As Long

Set OL = New Outlook.Application
Set olMsg = OL.CreateItem(olMailItem)

olMsg.Display
strHTMLFoot = olMsg.HTMLBody

lngBodypos = InStr(1, strHTMLFoot, "******")
lngBodypos = InStr(lngBodypos, strHTMLFoot, ">")

g_strHTMLFoot1 = Left(strHTMLFoot, lngBodypos)
g_strHTMLFoot2 = Mid(strHTMLFoot, (lngBodypos + 1))


olMsg.Close olDiscard
Set olMsg = Nothing
Set OL = Nothing


End Function