A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Forcing email to print landscape?



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old January 22nd 07, 07:12 PM posted to microsoft.public.outlook.program_vba
Keith
external usenet poster
 
Posts: 8
Default Forcing email to print landscape?

The code below (thanks again to those of you in this group!) is used from
within Excel VBA to create outlook emails to send with embedded images.

The problem I've run into is that the range of cells I'm pasting in happen
to be larger than 8.5 inches wide, so recipients who try to print the email
(without manually changing the print to landscape) get part of the image cut
off.

Is there a way to force an email message's default print setting to
landscape, or is that /only/ handled by the recipient's instance of Outlook?

Many thanks,
Keith



Function EmbeddedHTMLGraphicDemo(SendToName As String, SendFileCount As
Integer)
' Outlook objects
Dim objApp As Outlook.Application
Dim l_Msg As MailItem
Dim colAttach As Outlook.Attachments
Dim l_Attach As Outlook.Attachment
Dim oSession As MAPI.Session
' CDO objects
Dim oMsg As MAPI.Message
Dim oAttachs As MAPI.Attachments
Dim oAttach As MAPI.Attachment
Dim colFields As MAPI.Fields
Dim oField As MAPI.Field

Dim strEntryID As String

' create new Outlook MailItem
Set objApp = CreateObject("Outlook.Application")
Set l_Msg = objApp.CreateItem(olMailItem)
' add graphic as attachment to Outlook message
' change path to graphic as needed
Set colAttach = l_Msg.Attachments

FName = "c:\" & SendToName
FExt = ".gif"

For n = 1 To SendFileCount
Set l_Attach = colAttach.Add(FName & CStr(n) & FExt)
Next

l_Msg.Close olSave
strEntryID = l_Msg.EntryID
Set l_Msg = Nothing
' *** POSITION CRITICAL *** you must dereference the
' attachment objects before changing their properties
' via CDO
Set colAttach = Nothing
Set l_Attach = Nothing

' initialize CDO session
On Error Resume Next
Set oSession = CreateObject("MAPI.Session")
oSession.Logon "", "", False, False

' get the message created earlier
Set oMsg = oSession.GetMessage(strEntryID)
' set properties of the attached graphic that make
' it embedded and give it an ID for use in an IMG tag
Set oAttachs = oMsg.Attachments
For n = 1 To SendFileCount
Set oAttach = oAttachs.Item(n)
Set colFields = oAttach.Fields
Set oField = colFields.Add(CdoPR_ATTACH_MIME_TAG, "image/jpeg") '??
Set oField = colFields.Add(&H3712001E, "myident" & CStr(n))
Next
oMsg.Fields.Add "{0820060000000000C000000000000046}0x8514", 11, True
oMsg.Update

' get the Outlook MailItem again
Set l_Msg = objApp.GetNamespace("MAPI").GetItemFromID(strEntry ID)
' add HTML content -- the IMG tag
HTMLString = ""
For n = 1 To SendFileCount
HTMLString = HTMLString & "IMG align=baseline border=0 hspace=0
src=cid:myident" & _
CStr(n) & "" & "br /br" & "In your reply, please enter
updates for the record above he" & _
"br /br br /br"
Next
l_Msg.HTMLBody = HTMLString
l_Msg.To = SendToName
l_Msg.Subject = "Next Actions - please respond by 9am Thursday this week -
THANKS"
l_Msg.Close (olSave)
l_Msg.Display

' clean up objects
Set oField = Nothing
Set colFields = Nothing
Set oMsg = Nothing
oSession.Logoff
Set oSession = Nothing
Set objApp = Nothing
Set l_Msg = Nothing
End Function


  #2  
Old January 23rd 07, 05:40 AM posted to microsoft.public.outlook.program_vba
Michael Bauer [MVP - Outlook]
external usenet poster
 
Posts: 1,885
Default Forcing email to print landscape?


I'm sure that's up to the recipient. You could add a text to your e-mail
like 'best printed in landscape'

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
Keep your Outlook categories organized!
http://www.shareit.com/product.html?...4&languageid=1
(German: http://www.VBOffice.net/product.html?pub=6)


Am Mon, 22 Jan 2007 14:12:43 -0500 schrieb Keith:

The code below (thanks again to those of you in this group!) is used from
within Excel VBA to create outlook emails to send with embedded images.

The problem I've run into is that the range of cells I'm pasting in happen
to be larger than 8.5 inches wide, so recipients who try to print the

email
(without manually changing the print to landscape) get part of the image

cut
off.

Is there a way to force an email message's default print setting to
landscape, or is that /only/ handled by the recipient's instance of

Outlook?

Many thanks,
Keith



Function EmbeddedHTMLGraphicDemo(SendToName As String, SendFileCount As
Integer)
' Outlook objects
Dim objApp As Outlook.Application
Dim l_Msg As MailItem
Dim colAttach As Outlook.Attachments
Dim l_Attach As Outlook.Attachment
Dim oSession As MAPI.Session
' CDO objects
Dim oMsg As MAPI.Message
Dim oAttachs As MAPI.Attachments
Dim oAttach As MAPI.Attachment
Dim colFields As MAPI.Fields
Dim oField As MAPI.Field

Dim strEntryID As String

' create new Outlook MailItem
Set objApp = CreateObject("Outlook.Application")
Set l_Msg = objApp.CreateItem(olMailItem)
' add graphic as attachment to Outlook message
' change path to graphic as needed
Set colAttach = l_Msg.Attachments

FName = "c:\" & SendToName
FExt = ".gif"

For n = 1 To SendFileCount
Set l_Attach = colAttach.Add(FName & CStr(n) & FExt)
Next

l_Msg.Close olSave
strEntryID = l_Msg.EntryID
Set l_Msg = Nothing
' *** POSITION CRITICAL *** you must dereference the
' attachment objects before changing their properties
' via CDO
Set colAttach = Nothing
Set l_Attach = Nothing

' initialize CDO session
On Error Resume Next
Set oSession = CreateObject("MAPI.Session")
oSession.Logon "", "", False, False

' get the message created earlier
Set oMsg = oSession.GetMessage(strEntryID)
' set properties of the attached graphic that make
' it embedded and give it an ID for use in an IMG tag
Set oAttachs = oMsg.Attachments
For n = 1 To SendFileCount
Set oAttach = oAttachs.Item(n)
Set colFields = oAttach.Fields
Set oField = colFields.Add(CdoPR_ATTACH_MIME_TAG, "image/jpeg") '??
Set oField = colFields.Add(&H3712001E, "myident" & CStr(n))
Next
oMsg.Fields.Add "{0820060000000000C000000000000046}0x8514", 11, True
oMsg.Update

' get the Outlook MailItem again
Set l_Msg = objApp.GetNamespace("MAPI").GetItemFromID(strEntry ID)
' add HTML content -- the IMG tag
HTMLString = ""
For n = 1 To SendFileCount
HTMLString = HTMLString & "IMG align=baseline border=0 hspace=0
src=cid:myident" & _
CStr(n) & "" & "br /br" & "In your reply, please enter
updates for the record above he" & _
"br /br br /br"
Next
l_Msg.HTMLBody = HTMLString
l_Msg.To = SendToName
l_Msg.Subject = "Next Actions - please respond by 9am Thursday this week

-
THANKS"
l_Msg.Close (olSave)
l_Msg.Display

' clean up objects
Set oField = Nothing
Set colFields = Nothing
Set oMsg = Nothing
oSession.Logoff
Set oSession = Nothing
Set objApp = Nothing
Set l_Msg = Nothing
End Function

  #3  
Old January 23rd 07, 04:55 PM posted to microsoft.public.outlook.program_vba
Keith
external usenet poster
 
Posts: 8
Default Forcing email to print landscape?

That's what I was afraid of
I'll add the instruction for the printing.
Thanks,
Keith

"Michael Bauer [MVP - Outlook]" wrote in message
...

I'm sure that's up to the recipient. You could add a text to your e-mail
like 'best printed in landscape'

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook
Keep your Outlook categories organized!
http://www.shareit.com/product.html?...4&languageid=1
(German: http://www.VBOffice.net/product.html?pub=6)


Am Mon, 22 Jan 2007 14:12:43 -0500 schrieb Keith:

The code below (thanks again to those of you in this group!) is used from
within Excel VBA to create outlook emails to send with embedded images.

The problem I've run into is that the range of cells I'm pasting in
happen
to be larger than 8.5 inches wide, so recipients who try to print the

email
(without manually changing the print to landscape) get part of the image

cut
off.

Is there a way to force an email message's default print setting to
landscape, or is that /only/ handled by the recipient's instance of

Outlook?

Many thanks,
Keith



Function EmbeddedHTMLGraphicDemo(SendToName As String, SendFileCount As
Integer)
' Outlook objects
Dim objApp As Outlook.Application
Dim l_Msg As MailItem
Dim colAttach As Outlook.Attachments
Dim l_Attach As Outlook.Attachment
Dim oSession As MAPI.Session
' CDO objects
Dim oMsg As MAPI.Message
Dim oAttachs As MAPI.Attachments
Dim oAttach As MAPI.Attachment
Dim colFields As MAPI.Fields
Dim oField As MAPI.Field

Dim strEntryID As String

' create new Outlook MailItem
Set objApp = CreateObject("Outlook.Application")
Set l_Msg = objApp.CreateItem(olMailItem)
' add graphic as attachment to Outlook message
' change path to graphic as needed
Set colAttach = l_Msg.Attachments

FName = "c:\" & SendToName
FExt = ".gif"

For n = 1 To SendFileCount
Set l_Attach = colAttach.Add(FName & CStr(n) & FExt)
Next

l_Msg.Close olSave
strEntryID = l_Msg.EntryID
Set l_Msg = Nothing
' *** POSITION CRITICAL *** you must dereference the
' attachment objects before changing their properties
' via CDO
Set colAttach = Nothing
Set l_Attach = Nothing

' initialize CDO session
On Error Resume Next
Set oSession = CreateObject("MAPI.Session")
oSession.Logon "", "", False, False

' get the message created earlier
Set oMsg = oSession.GetMessage(strEntryID)
' set properties of the attached graphic that make
' it embedded and give it an ID for use in an IMG tag
Set oAttachs = oMsg.Attachments
For n = 1 To SendFileCount
Set oAttach = oAttachs.Item(n)
Set colFields = oAttach.Fields
Set oField = colFields.Add(CdoPR_ATTACH_MIME_TAG, "image/jpeg") '??
Set oField = colFields.Add(&H3712001E, "myident" & CStr(n))
Next
oMsg.Fields.Add "{0820060000000000C000000000000046}0x8514", 11, True
oMsg.Update

' get the Outlook MailItem again
Set l_Msg = objApp.GetNamespace("MAPI").GetItemFromID(strEntry ID)
' add HTML content -- the IMG tag
HTMLString = ""
For n = 1 To SendFileCount
HTMLString = HTMLString & "IMG align=baseline border=0 hspace=0
src=cid:myident" & _
CStr(n) & "" & "br /br" & "In your reply, please enter
updates for the record above he" & _
"br /br br /br"
Next
l_Msg.HTMLBody = HTMLString
l_Msg.To = SendToName
l_Msg.Subject = "Next Actions - please respond by 9am Thursday this
week

-
THANKS"
l_Msg.Close (olSave)
l_Msg.Display

' clean up objects
Set oField = Nothing
Set colFields = Nothing
Set oMsg = Nothing
oSession.Logoff
Set oSession = Nothing
Set objApp = Nothing
Set l_Msg = Nothing
End Function



 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
can't print in landscape cl Outlook - Calandaring 2 February 1st 07 01:53 PM
Change note space for contact to landscape view? Work in Progress Outlook - Using Contacts 1 October 4th 06 08:40 PM
Writing additional notes in Landscape format Gingersnapped88 Outlook - Using Contacts 0 September 30th 06 10:21 PM
IE6/Outlook Default Page Orientation Is Landscape rob Outlook - General Queries 3 June 22nd 06 01:38 AM
How do I print a monthly Outlook 2000 calendar landscape? Jody Outlook - Calandaring 0 January 24th 06 05:56 PM


All times are GMT +1. The time now is 06:55 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.