ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Simple Print Macros (https://www.excelbanter.com/excel-programming/381556-simple-print-macros.html)

Hank Youngerman

Simple Print Macros
 
I would like to write a simple macro that would open and print all the
emails in a folder. How do I write and execute it? Seems like it
should be simple.

I think it will be something like:

Select folder
For each mailitem in
mailitem.open
mailitem.print
next mailitem

But I don't know the exact syntax.

Thanks in advance.


mrice[_2_]

Simple Print Macros
 


"Hank Youngerman" wrote:

I would like to write a simple macro that would open and print all the
emails in a folder. How do I write and execute it? Seems like it
should be simple.

I think it will be something like:

Select folder
For each mailitem in
mailitem.open
mailitem.print
next mailitem

But I don't know the exact syntax.

Thanks in advance.



mrice[_2_]

Simple Print Macros
 
If you make a reference to the MS Outlook object library, you will then get
extended help that will address how to drive outlook from Excel

Martin

"Hank Youngerman" wrote:

I would like to write a simple macro that would open and print all the
emails in a folder. How do I write and execute it? Seems like it
should be simple.

I think it will be something like:

Select folder
For each mailitem in
mailitem.open
mailitem.print
next mailitem

But I don't know the exact syntax.

Thanks in advance.



Bob Phillips

Simple Print Macros
 
Sub GetEmails()
Const oFolderInbox As Long = 6
Dim oOL As Object
Dim oNameSpace As Object 'Outlook.NameSpace
Dim oInbox As Object 'Outlook.MAPIFolder
Dim oItem As Object

Set oOL = CreateObject("Outlook.Application")

Set oNameSpace = oOL.GetNamespace("MAPI")

Set oInbox = oNameSpace.GetDefaultFolder(oFolderInbox)

'Make Outlook visible
oInbox.Display

For Each oItem In oInbox.items
oItem.PrintOut
Next oItem

End Sub


--
HTH

Bob Phillips

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Hank Youngerman" wrote in message
ups.com...
I would like to write a simple macro that would open and print all the
emails in a folder. How do I write and execute it? Seems like it
should be simple.

I think it will be something like:

Select folder
For each mailitem in
mailitem.open
mailitem.print
next mailitem

But I don't know the exact syntax.

Thanks in advance.





All times are GMT +1. The time now is 09:33 AM.

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