Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Me.PrintForm - landscape
I've set up my form, filled it in, and now I want to print it.
Me.PrintForm does print the form but it prints portrait. I want it printed landscape. Any one know how to do it? Henry |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Me.PrintForm - landscape
Henry,
Show the form. Copy it using Alt+Prt Scrn keys. Dismiss the form. Paste into a blank Excel sheet. Print it the way you want. Jim Cone San Francisco, USA "Henry" wrote in message ... I've set up my form, filled it in, and now I want to print it. Me.PrintForm does print the form but it prints portrait. I want it printed landscape. Any one know how to do it? Henry |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Me.PrintForm - landscape
Jim,
Thanks, but that's not what I want. This program is for children and everything must be as automatic as possible. There's a "Print" button on the form which I use to print the form. At the moment I've got. Sub PrintButton_Click() Me.PrintForm End Sub That prints the form, but portrait style. I need to adjust the code to make it print landscape. Henry "Jim Cone" wrote in message ... Henry, Show the form. Copy it using Alt+Prt Scrn keys. Dismiss the form. Paste into a blank Excel sheet. Print it the way you want. Jim Cone San Francisco, USA "Henry" wrote in message ... I've set up my form, filled it in, and now I want to print it. Me.PrintForm does print the form but it prints portrait. I want it printed landscape. Any one know how to do it? Henry |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Me.PrintForm - landscape
This was posted by Tom Ogilvy:
Modification of code originally posted by "Orlando Magalhães Filho" Modified to capture just the userform (not the whole window). In a general module: 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 = 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 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 'added to force landscape ActiveSheet.PageSetup.orientation = xlLandscape ActiveWindow.SelectedSheets.PrintOut Copies:=1 ActiveWorkbook.Close False End Sub I added a line that changed the orientation to landscape. Henry wrote: I've set up my form, filled it in, and now I want to print it. Me.PrintForm does print the form but it prints portrait. I want it printed landscape. Any one know how to do it? Henry -- Dave Peterson |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Me.PrintForm - landscape
Thanks Dave, Tom and Orlando.
What a lot of code for what seemed a simple problem. I'll try it later. Once again, thanks. Henry "Dave Peterson" wrote in message ... This was posted by Tom Ogilvy: Modification of code originally posted by "Orlando Magalhães Filho" Modified to capture just the userform (not the whole window). In a general module: 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 = 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 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 'added to force landscape ActiveSheet.PageSetup.orientation = xlLandscape ActiveWindow.SelectedSheets.PrintOut Copies:=1 ActiveWorkbook.Close False End Sub I added a line that changed the orientation to landscape. Henry wrote: I've set up my form, filled it in, and now I want to print it. Me.PrintForm does print the form but it prints portrait. I want it printed landscape. Any one know how to do it? Henry -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
cannot get excel sheet to print landscape even when set landscape | Setting up and Configuration of Excel | |||
me.printform | Excel Programming | |||
Problem with printform | Excel Programming | |||
printform vba | Excel Programming | |||
PrintForm Problem!! | Excel Programming |