WUGNET, the Windows User Group Network
Your Complete Resource Center for "The Best" in Shareware, Computing Tips and Support, Windows Industry News... and much more!
Home Forums Shareware Windows Tips Hot Offers FREE Newsletters Arcade Contact Us About Partners
Search WUGNET: RSS Feeds RSS Feeds Advertise with WUGNET    |    Shareware eBooks
HomeHome FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Closing Outlook VBE from Excel

 
   Home -> Office -> Programming VBA RSS
Next:  Programmatically creating emails with default sta..  
Author Message
Stephen Lloyd

External


Since: Jun 24, 2008
Posts: 23



(Msg. 1) Posted: Tue Oct 28, 2008 11:26 am
Post subject: Closing Outlook VBE from Excel
Archived from groups: microsoft>public>outlook>program_vba (more info?)

I posted this in the Excel forum because I'm automating from Excel, however,
I thought I'd try here as well.

In Excel I instatiate outlook using the following.

On Error Resume Next
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 to declare the VBE app and then use the
..Quit method, but I have been unable to locate the appname for Outlooks VBE
to refernce in GetObject([path] [,appname]). Does anyone know the appname
and/or a better way to close Outlook's VBE?
Back to top
Login to vote
Ken Slovak - [MVP - Outlo

External


Since: Oct 17, 2003
Posts: 2898



(Msg. 2) Posted: Tue Oct 28, 2008 2:57 pm
Post subject: Re: Closing Outlook VBE from Excel [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

The better way is to not have to open the VBE at all. If you place whatever
macros you want to call in the ThisOutlookSession class module, declared as
Public, you can call them directly from your code. If you have a macro
"Foobar" that's public you can then call it from your code as
objOutlook.Foobar().

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Stephen Lloyd" <StephenLloyd DeleteThis @discussions.microsoft.com> wrote in message
news:66AC230E-C783-4A91-813F-7BE811458B84@microsoft.com...
>I posted this in the Excel forum because I'm automating from Excel,
>however,
> I thought I'd try here as well.
>
> In Excel I instatiate outlook using the following.
>
> On Error Resume Next
> 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 to declare the VBE app and then use
> the
> .Quit method, but I have been unable to locate the appname for Outlooks
> VBE
> to refernce in GetObject([path] [,appname]). Does anyone know the appname
> and/or a better way to close Outlook's VBE?
>
Back to top
Login to vote
Stephen Lloyd

External


Since: Jun 24, 2008
Posts: 23



(Msg. 3) Posted: Tue Oct 28, 2008 5:11 pm
Post subject: Re: Closing Outlook VBE from Excel [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Thank you sir. I'll go make them public.

"Ken Slovak - [MVP - Outlook]" wrote:

> The better way is to not have to open the VBE at all. If you place whatever
> macros you want to call in the ThisOutlookSession class module, declared as
> Public, you can call them directly from your code. If you have a macro
> "Foobar" that's public you can then call it from your code as
> objOutlook.Foobar().
>
> --
> Ken Slovak
> [MVP - Outlook]
> http://www.slovaktech.com
> Author: Professional Programming Outlook 2007.
> Reminder Manager, Extended Reminders, Attachment Options.
> http://www.slovaktech.com/products.htm
>
>
> "Stephen Lloyd" <StephenLloyd.DeleteThis@discussions.microsoft.com> wrote in message
> news:66AC230E-C783-4A91-813F-7BE811458B84@microsoft.com...
> >I posted this in the Excel forum because I'm automating from Excel,
> >however,
> > I thought I'd try here as well.
> >
> > In Excel I instatiate outlook using the following.
> >
> > On Error Resume Next
> > 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 to declare the VBE app and then use
> > the
> > .Quit method, but I have been unable to locate the appname for Outlooks
> > VBE
> > to refernce in GetObject([path] [,appname]). Does anyone know the appname
> > and/or a better way to close Outlook's VBE?
> >
>
>
Back to top
Login to vote
Display posts from previous:   
       Home -> Office -> Programming VBA All times are: Eastern Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Categories:
 Windows XP
 Windows Vista
 Windows Other
  Office
 Office Other
 Security
 WinRAR
  • Home |
  • Shareware |
  • Windows Tips |
  • Hot Offers |
  • FREE Newsletters |
  • Arcade |
  • Forums |
  • eBooks |
  • About WUGNET |
  • Partners |
  • Contact

  • WUGNET Privacy Policy |
  • Link to WUGNET