TheBeefMan
New Member
- Joined
- Sep 20, 2007
- Messages
- 7
Please can anyone help me print a userform automatically in landscape mode? I just can't seem to get the code right. I would appreciate any leads.
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
Private Sub CommandButton1_Click()
Application.ScreenUpdating = False
keybd_event VK_SNAPSHOT, 1, 0, 0
Workbooks.Add 1
ActiveSheet.Range("A1").Select
Application.Wait Now + TimeValue("00:00:01")
ActiveSheet.PasteSpecial Format:="Bitmap", Link:=False, DisplayAsIcon:=False
With ActiveSheet
.PageSetup.Orientation = xlLandscape
.PageSetup.LeftHeader = "Userform1"
.PrintOut
End With
ActiveWorkbook.Close False
Unload Me
Application.ScreenUpdating = True
End Sub