ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Closing Outlook VBE from Excel (https://www.excelbanter.com/excel-programming/419172-closing-outlook-vbe-excel.html)

Stephen Lloyd[_2_]

Closing Outlook VBE from Excel
 
In outlook I instatiate outlook using the following.

Set objOutlook = GetObject(, "Outlook.Application")
' If outlook was not open then instantiate outlook
If objOutlook Is Nothing Then
Set objOutlook = CreateObject("Outlook.Application")
'HandleOutlook = True
End If

In Outlook in the Application_Startup() Event I then open the VBE so that I
can call an outlook macro from excel without any popups using the following

Set objNameSpace = Application.GetNamespace("MAPI")
Set objExplorer = Application.Explorers.Add(objNameSpace.Folders(1),
olFolderDisplayFolderOnly)
objExplorer.CommandBars.FindControl(, 1695).Execute
objExplorer.Close

My problem is that I cannot figure out how to close Outlook's VBE from Excel

I'd like to use the GetObject method then using the .Quit method, but I have
been unable to locate the appname for Outlooks VBE. Does anyone know the
appname and/or a better way to close Outlook's VBE?

Stephen Lloyd[_2_]

Closing Outlook VBE from Excel
 
Quick correction... In Excel I instantiate outlook using the following

Set objOutlook = GetObject(, "Outlook.Application")
' If outlook was not open then instantiate outlook
If objOutlook Is Nothing Then
Set objOutlook = CreateObject("Outlook.Application")
'HandleOutlook = True
End If

In Outlook in the Application_Startup() Event I then open the VBE so that I
can call an outlook macro from excel without any popups using the following

Set objNameSpace = Application.GetNamespace("MAPI")
Set objExplorer = Application.Explorers.Add(objNameSpace.Folders(1),
olFolderDisplayFolderOnly)
objExplorer.CommandBars.FindControl(, 1695).Execute
objExplorer.Close

My problem is that I cannot figure out how to close Outlook's VBE from Excel

I'd like to use the GetObject method then using the .Quit method, but I have
been unable to locate the appname for Outlooks VBE. Does anyone know the
appname and/or a better way to close Outlook's VBE?



All times are GMT +1. The time now is 02:37 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com