Sleeper: 'New Outlook' Broken my VBA
Good Morning All.
Hopefully this will be a quick one.
Op: Office365 (enterprise)
Outlook: version 2303 (16227.20280)
The Problem.
Having developed and running the workbook withou issue for about 12months it has now started erroring.
At the startup of the workbook the users email address is got (to both log and send messages in the background redaing selections they make).
To stop it falling over, i added a line to check if outlook is running, and if not tell them it needs to be and then closes the book.
(Code below).
Now with the recent release of 'New Outlook' (toggle)
http://www.vbaexpress.com/forum/imag...AASUVORK5CYII=
If I have this version of outlook running instead, [which I quite like], then the code line does not see outlook as running?!? (and therefore doenot pick up the users email either)
Any suggestions why this might be would be great, would like to get something inplace before work pushes the release out formally.
cheers.
M.
TLDR: If current Outlook is open oOutlook NOT Nothing; if New Outlook is open, oOutlook IS Nothing; if Outlook is closed, oOutlook IS Nothing.
The Code:
Code:
Public Sub email_hunter()
Dim oOutlook As Object 'Checks Outlook is open.
On Error Resume Next
Set oOutlook = GetObject(, "Outlook.Application")
On Error GoTo 0
If oOutlook Is Nothing Then
MsgBox "Outlook is not open, open Outlook and try again. " & vbNewLine & vbNewLine & _
"'New Outlook' does not work either(PreRelease)" & vbNewLine & vbNewLine & _
"Please open Outloook email and try again."
ActiveWorkbook.Close SaveChanges:=False
Else
Call mod_MISC.currentUserEmailAddress
USER_email = currentUserEmailAddress
End If
end sub