Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Printing multi-pages | Excel Discussion (Misc queries) | |||
printing multi pages on one sheet | Setting up and Configuration of Excel | |||
multi pages in work book | Excel Discussion (Misc queries) | |||
Changing orientation of pages | Excel Worksheet Functions | |||
I want to print multi pages on one page. | Excel Discussion (Misc queries) |