Print out MS Outlook calendars via VBA WITHIN MS Outlook 
Author Message
 Print out MS Outlook calendars via VBA WITHIN MS Outlook

I want to print out MS Outlook calendars via VBA WITHIN MS Outlook.

It is critical that I be able to print these calendars WITHIN Outlook.

Does anybody know a way?

Thanks

JZ



Fri, 24 Jun 2005 23:52:31 GMT  
 Print out MS Outlook calendars via VBA WITHIN MS Outlook
The only printing mechanism in VBA that I'm aware of is the PrintOut method;
however, this only applies to singular instances of Outlook items (a
calendar entry, e-mail, contact, etc).  You can also try using the
FindControl method of the  CommandBars collection from the Office Object
Library to retrieve the Print command menu item, and then call it's Execute
method.  But you'd need to assume that the user has an appropriate Calendar
view selected in Outlook for this to work as you'd like.

--
Eric Legault, MCSD
ADAPSYS
http://www.adapsys.ca


Quote:
> I want to print out MS Outlook calendars via VBA WITHIN MS Outlook.

> It is critical that I be able to print these calendars WITHIN Outlook.

> Does anybody know a way?

> Thanks

> JZ



Sat, 25 Jun 2005 00:16:42 GMT  
 Print out MS Outlook calendars via VBA WITHIN MS Outlook
I was able to figure out which control it and created the following code:
    CommandBars("Standard").Controls(5).Execute

Unfortunately when I ran it I got the following error message:

"Run-time error '-214767259 (80004005)':
Method 'Execute' of object '_CommandBarButton' failed."

Did I just hit a wall?

JZ

Quote:

> The only printing mechanism in VBA that I'm aware of is the PrintOut method;
> however, this only applies to singular instances of Outlook items (a
> calendar entry, e-mail, contact, etc).  You can also try using the
> FindControl method of the  CommandBars collection from the Office Object
> Library to retrieve the Print command menu item, and then call it's Execute
> method.  But you'd need to assume that the user has an appropriate Calendar
> view selected in Outlook for this to work as you'd like.

> --
> Eric Legault, MCSD
> ADAPSYS
> http://www.adapsys.ca



Sat, 25 Jun 2005 08:40:22 GMT  
 Print out MS Outlook calendars via VBA WITHIN MS Outlook
Man, I've run into this before, but I'm scratching my head at the moment
trying to remember the particulars.  This article, though, might illuminate
your situation:

http://support.microsoft.com/default.aspx?scid=kb;en-us;201095

Eric


Quote:
> I was able to figure out which control it and created the following code:
>     CommandBars("Standard").Controls(5).Execute

> Unfortunately when I ran it I got the following error message:

> "Run-time error '-214767259 (80004005)':
> Method 'Execute' of object '_CommandBarButton' failed."

> Did I just hit a wall?

> JZ




Quote:
> > The only printing mechanism in VBA that I'm aware of is the PrintOut
method;
> > however, this only applies to singular instances of Outlook items (a
> > calendar entry, e-mail, contact, etc).  You can also try using the
> > FindControl method of the  CommandBars collection from the Office Object
> > Library to retrieve the Print command menu item, and then call it's
Execute
> > method.  But you'd need to assume that the user has an appropriate
Calendar
> > view selected in Outlook for this to work as you'd like.

> > --
> > Eric Legault, MCSD
> > ADAPSYS
> > http://www.adapsys.ca



Sat, 25 Jun 2005 11:29:36 GMT  
 Print out MS Outlook calendars via VBA WITHIN MS Outlook
I'm getting closer...
    Set MyCB = ActiveExplorer.CommandBars.Item("Menu Bar")
    Set MyMenu = MyCB.Controls("File")
    Set MyMenuItem = MyMenu.Controls("Print...")
    MyMenuItem.Execute
<<<<<<<<<<<<<

This will bring up the Print Dialog.

Now, how do I get it to actually print?  Is there a way to click the
OK button programmatically?

Thanks.



Wed, 29 Jun 2005 08:07:02 GMT  
 Print out MS Outlook calendars via VBA WITHIN MS Outlook
Yup - use the SendKeys statement.

--
Eric Legault, MCSD
ADAPSYS - http://www.adapsys.ca


Quote:
> I'm getting closer...

>     Set MyCB = ActiveExplorer.CommandBars.Item("Menu Bar")
>     Set MyMenu = MyCB.Controls("File")
>     Set MyMenuItem = MyMenu.Controls("Print...")
>     MyMenuItem.Execute
> <<<<<<<<<<<<<

> This will bring up the Print Dialog.

> Now, how do I get it to actually print?  Is there a way to click the
> OK button programmatically?

> Thanks.



Sat, 02 Jul 2005 01:40:46 GMT  
 Print out MS Outlook calendars via VBA WITHIN MS Outlook
I tried it but it's not working.  Here's the code:
    Set MyCB = ActiveExplorer.CommandBars.Item("Menu Bar")
    Set MyMenu = MyCB.Controls("File")
    Set MyMenuItem = MyMenu.Controls("Print...")
    MyMenuItem.Execute
    SendKeys "{ENTER}"
<<<<<<<<<<<<<

The issue: When the application hits "MyMenuItem.Execute" the Print
Dialog appears and stays there!  Only after I hit Enter does it move
on to the next statement.

Argggh!!!

JZ



Sat, 02 Jul 2005 06:19:34 GMT  
 Print out MS Outlook calendars via VBA WITHIN MS Outlook

Yeah, you're right, because the stupid Print dialog is modal.  How about
using the Print button instead of the Print... menu item; this works for me:

Dim MyCBC as CommandBarControl

Set MyCBC = ActiveExplorer.CommandBars.FindControl(, 4)
MyCBC.Execute

--
Eric Legault, MCSD
ADAPSYS - http://www.adapsys.ca


Quote:
> I tried it but it's not working.  Here's the code:

>     Set MyCB = ActiveExplorer.CommandBars.Item("Menu Bar")
>     Set MyMenu = MyCB.Controls("File")
>     Set MyMenuItem = MyMenu.Controls("Print...")
>     MyMenuItem.Execute
>     SendKeys "{ENTER}"
> <<<<<<<<<<<<<

> The issue: When the application hits "MyMenuItem.Execute" the Print
> Dialog appears and stays there!  Only after I hit Enter does it move
> on to the next statement.

> Argggh!!!

> JZ



Sat, 02 Jul 2005 23:40:20 GMT  
 Print out MS Outlook calendars via VBA WITHIN MS Outlook
Hey Josh, I just came across some more information that may give you some
alternatives:

http://support.microsoft.com/default.aspx?scid=kb;en-us;290775

--
Eric Legault, MCSD
ADAPSYS - http://www.adapsys.ca


Quote:
> I tried it but it's not working.  Here's the code:

>     Set MyCB = ActiveExplorer.CommandBars.Item("Menu Bar")
>     Set MyMenu = MyCB.Controls("File")
>     Set MyMenuItem = MyMenu.Controls("Print...")
>     MyMenuItem.Execute
>     SendKeys "{ENTER}"
> <<<<<<<<<<<<<

> The issue: When the application hits "MyMenuItem.Execute" the Print
> Dialog appears and stays there!  Only after I hit Enter does it move
> on to the next statement.

> Argggh!!!

> JZ



Sun, 03 Jul 2005 01:09:12 GMT  
 
 [ 9 post ] 

 Relevant Pages 

1. Access to the Outlook Calendar via VBA

2. Can we prevent web surfing within MS Outlook?

3. MS PJ 2000 and MS Word via VBA

4. Searching MS Outlook from within VB6

5. Opening MS Outlook within VB6 Form

6. Use VBScript to read data from MS-Access to MS-Outlook

7. Automatically Emailing Data from MS Access to MS Outlook

8. Automatically Emailing Data from MS Access to MS Outlook

9. automation from ms access to ms outlook to do something

10. send email automatically from Filemaker via MS Outlook 2000

11. DDE between MS Access and MS Outlook

12. Accept drops of messages from Outlook and Dragging attachments from MS Outlook

 

 
Powered by phpBB® Forum Software