Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Print Excel Form In Landscape Mode?

I wish to use VBA to print an Excel form in Landscape mode. Is this
possible? Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Print Excel Form In Landscape Mode?

Jeffrey,
Try recording a macro of the desired actions an dedit the code as needed.

NickHK

"Jeffrey" wrote in message
m...
I wish to use VBA to print an Excel form in Landscape mode. Is this
possible? Thanks.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default Print Excel Form In Landscape Mode?

Here's a modification by Tom Ogilvy of a Orlando Magalhães Filho post:

========================

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
ActiveWindow.SelectedSheets.PrintOut Copies:=1
ActiveWorkbook.Close False
End Sub

--
Regards,
Tom Ogilvy

Jeffrey wrote:

I wish to use VBA to print an Excel form in Landscape mode. Is this
possible? Thanks.


--

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
page setup landscape, but print footer in portrait mode tbrown Excel Discussion (Misc queries) 0 October 22nd 07 11:01 PM
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
ofice 2003 powerpoint does not print in landscape mode Baffled_Bill Excel Discussion (Misc queries) 2 January 15th 05 05:59 PM
Printing Excel in Landscape mode... sai Excel Programming 1 February 10th 04 03:09 PM
print a form landscape Dave[_32_] Excel Programming 0 December 17th 03 05:00 PM


All times are GMT +1. The time now is 02:44 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"