Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Printer orientation with multi pages


Hi - I'm printing a number of pages from a multi mage control on a
userform.
I need to print it landscape but don't know how to set the orientation
programatically.

Any hints?
Thanks


--
skuzapo
------------------------------------------------------------------------
skuzapo's Profile: http://www.excelforum.com/member.php...o&userid=27430
View this thread: http://www.excelforum.com/showthread...hreadid=514614

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Printer orientation with multi pages

Turn on the macro recorder and do it manually.

Then look at the recorded code.

Use only the properties you need to actually set as there is a significant
overhead for the execution of each line.

--
Regards,
Tom Ogilvy

"skuzapo" wrote in
message ...

Hi - I'm printing a number of pages from a multi mage control on a
userform.
I need to print it landscape but don't know how to set the orientation
programatically.

Any hints?
Thanks


--
skuzapo
------------------------------------------------------------------------
skuzapo's Profile:

http://www.excelforum.com/member.php...o&userid=27430
View this thread: http://www.excelforum.com/showthread...hreadid=514614



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Printer orientation with multi pages


Hi Tom,

I've got the following bit of code from the macro I recorded.

Sub Macro1()

ActiveSheet.PageSetup.PrintArea = "$B$4:$E$17"
With ActiveSheet.PageSetup
..Orientation = xlLandscape
End With
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
End Sub

I'm trying to print landscape from a multpage control though so when I
use the "Activesheet.PageSetup" the user form still prints in
Portrait.

The Multipage control doesn't support something like:

With Me.mpgCalculations.Pages
..Orientation = xlLandscape
End With

Am I missing something here?
Thanks for your help...


--
skuzapo
------------------------------------------------------------------------
skuzapo's Profile: http://www.excelforum.com/member.php...o&userid=27430
View this thread: http://www.excelforum.com/showthread...hreadid=514614

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Printer orientation with multi pages

You would probably need to copy an image of the userform on which the
multipage is hosted, and paste that on a sheet, then print the sheet with
the printarea set to the area occupied by the image.

the basic approach would be:

Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, _
ByVal bScan As Byte, ByVal dwFlags As Long, _
ByVal dwExtraInfo As Long)

'Public Const VK_SNAPSHOT = &H2C

Public Const VK_SNAPSHOT = 44
Public Const VK_LMENU = 164
Public Const KEYEVENTF_KEYUP = 2
Public Const KEYEVENTF_EXTENDEDKEY = 1


Sub Test()
UserForm1.Show
End Sub


In the userform module:




Private Sub CommandButton1_Click()
' keybd_event VK_SNAPSHOT, 0, 0, 0
DoEvents
keybd_event VK_LMENU, 0, _
KEYEVENTF_EXTENDEDKEY, 0 ' key down
keybd_event VK_SNAPSHOT, 0, _
KEYEVENTF_EXTENDEDKEY, 0
keybd_event VK_SNAPSHOT, 0, _
KEYEVENTF_EXTENDEDKEY + KEYEVENTF_KEYUP, 0
keybd_event VK_LMENU, 0, _
KEYEVENTF_EXTENDEDKEY + KEYEVENTF_KEYUP, 0
DoEvents
Workbooks.Add
Application.Wait Now + TimeValue("00:00:01")
ActiveSheet.PasteSpecial Format:="Bitmap", _
Link:=False, DisplayAsIcon:=False
ActiveSheet.Range("A1").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1
ActiveWorkbook.Close False
End Sub

--
Regards,
Tom Ogilvy



"skuzapo" wrote in
message ...

Hi Tom,

I've got the following bit of code from the macro I recorded.

Sub Macro1()

ActiveSheet.PageSetup.PrintArea = "$B$4:$E$17"
With ActiveSheet.PageSetup
Orientation = xlLandscape
End With
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
End Sub

I'm trying to print landscape from a multpage control though so when I
use the "Activesheet.PageSetup" the user form still prints in
Portrait.

The Multipage control doesn't support something like:

With Me.mpgCalculations.Pages
Orientation = xlLandscape
End With

Am I missing something here?
Thanks for your help...


--
skuzapo
------------------------------------------------------------------------
skuzapo's Profile:

http://www.excelforum.com/member.php...o&userid=27430
View this thread: http://www.excelforum.com/showthread...hreadid=514614



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Printer orientation with multi pages


Thanks for your detailed assistance Tom.
I'll try that out.
Cheers


--
skuzapo
------------------------------------------------------------------------
skuzapo's Profile: http://www.excelforum.com/member.php...o&userid=27430
View this thread: http://www.excelforum.com/showthread...hreadid=514614

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Printing multi-pages yclhk Excel Discussion (Misc queries) 1 November 9th 09 04:50 PM
printing multi pages on one sheet Ms. J Setting up and Configuration of Excel 1 April 26th 07 03:56 AM
multi pages in work book jason2444 Excel Discussion (Misc queries) 2 September 19th 06 01:44 PM
Changing orientation of pages Louise Excel Worksheet Functions 1 September 29th 05 04:53 PM
I want to print multi pages on one page. Laurie Excel Discussion (Misc queries) 2 August 24th 05 11:44 AM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"