Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #5  
Old 05-13-2016, 09:00 AM
mktate mktate is offline Print Multipage Userform in Landscape Windows 10 Print Multipage Userform in Landscape Office 2010 64bit
Novice
Print Multipage Userform in Landscape
 
Join Date: Dec 2015
Posts: 26
mktate is on a distinguished road
Default Code that doesn't work

Here is Code I tried to change for a Word userform, using ActiveDocument instead of Application, but I get bugs virtually every line. I am not a coder, so then I tried to just delete what didn't have a home in a Word document, eventually getting multiple pages of the userform to print, but again in portrait, not landscape. So, if anyone can modify this code to try to get a multipage Word userform to print in landscape, I would greatly appreciate it! (I give the original code, not my attempted revisions):
Code:
Option Explicit
 
Private Declare PtrSafe Sub keybd_event Lib "user32" _
(ByVal bVk As Byte, ByVal bScan As Byte, _
ByVal dwFlags As Long, ByVal dwExtraInfo As LongPtr)
Const VK_SNAPSHOT = 44
Const VK_LMENU = 164
Const KEYEVENTF_KEYUP = 2
Const KEYEVENTF_EXTENDEDKEY = 1
 
Private Sub CommandButton1_Click()
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
 
 
With ActiveSheet.PageSetup
  .PrintTitleRows = ""
  .PrintTitleColumns = ""
End With
 
ActiveSheet.PageSetup.PrintArea = ""
 
With ActiveSheet.PageSetup
  .LeftHeader = ""
  .CenterHeader = ""
  .RightHeader = ""
  .LeftFooter = ""
  .CenterFooter = ""
  .RightFooter = ""
  .LeftMargin = Application.InchesToPoints(0.75)
  .RightMargin = Application.InchesToPoints(0.75)
  .TopMargin = Application.InchesToPoints(1)
  .BottomMargin = Application.InchesToPoints(1)
  .HeaderMargin = Application.InchesToPoints(0.5)
  .FooterMargin = Application.InchesToPoints(0.5)
  .PrintHeadings = False
  .PrintGridlines = False
  .PrintComments = xlPrintNoComments
  .PrintQuality = 300
  .CenterHorizontally = True
  .CenterVertically = True
  .Orientation = xlLandscape
  .Draft = False
  .PaperSize = xlPaperA4
  .FirstPageNumber = xlAutomatic
  .Order = xlDownThenOver
  .BlackAndWhite = False
  .Zoom = False
  .FitToPagesWide = 1
  .FitToPagesTall = 1
End With
ActiveWindow.SelectedSheets.PrintOut Copies:=1
ActiveWorkbook.Close False
End Sub

Last edited by macropod; 05-13-2016 at 03:42 PM. Reason: Added code tags & formatting
Reply With Quote
 

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Landscape Orientation - Rotate page so top of landscape is printed on left side swifty2010 Word 17 06-11-2022 05:50 PM
Print Multipage Userform in Landscape Convert large multipage table to jpeg idiotwind Word Tables 3 12-01-2015 03:53 AM
Print Multipage Userform in Landscape Large number of landscape pages within a portrait doc--do I have to textbox by hand every landscape? mlkmnsgrl Word 7 01-05-2015 05:19 PM
Print 2 pages to a sheet in Landscape page orientation Alexie Excel 1 09-18-2010 01:29 AM
Multicolumn Multipage makaveli89 Word 0 11-10-2008 11:52 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:18 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft