Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 104
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 104
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 104
Default 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
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
cannot get excel sheet to print landscape even when set landscape williedon Setting up and Configuration of Excel 1 August 2nd 06 12:18 AM
me.printform David Excel Programming 1 August 24th 04 07:18 PM
Problem with printform [email protected] Excel Programming 4 August 4th 04 03:18 AM
printform vba BlackBlade Excel Programming 0 November 24th 03 06:28 AM
PrintForm Problem!! Sebastien[_2_] Excel Programming 0 July 13th 03 06:26 PM


All times are GMT +1. The time now is 10:46 AM.

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

About Us

"It's about Microsoft Excel"