Results 1 to 3 of 3

Thread: [FAQ's: OD] How do I change the drawing layout and/or page size?

Threaded View

  1. #1

    Thread Starter
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    [FAQ's: OD] How do I change the drawing layout and/or page size?

    Changing the drawing layout from Portrait to Landscape or Landscape to Portrait is allot different in Visio then other Office Apps. Same for changing the drawing size too. Its objects are organized differently and a bit burried down the object heirarchy.


    Visio 2003 VBA Code Example:

    VB Code:
    1. Option Explicit
    2. 'Behind ThisDocument
    3. 'Note: Assumes current open drawing is "Drawing1.vsd"
    4. Private Sub ChangeLayout()
    5.     Application.Documents("Drawing1.vsd").Pages(1).PageSheet.CellsSRC(visSectionObject, _
    6.     visRowPrintProperties, visPrintPropertiesPageOrientation).FormulaU = "2"
    7. End Sub
    8.  
    9. Private Sub ChangePageSize(ByVal strWidth As String, ByVal strHeight As String)
    10.     Application.Documents("Drawing1.vsd").Pages(1).PageSheet.CellsSRC(visSectionObject, _
    11.     visRowPage, visPageWidth).FormulaU = "11 in"
    12.     Application.Documents("Drawing1.vsd").Pages(1).PageSheet.CellsSRC(visSectionObject, _
    13.     visRowPage, visPageHeight).FormulaU = "8.5 in"
    14. End Sub
    VB Code:
    1. 'Example Usage:
    2. Private Sub Command1_Click()
    3.     ChangeLayout
    4. End Sub
    5.  
    6. Private Sub Command2_Click()
    7.     ChangePageSize "11 in", 8.5 in"
    8. End Sub
    Last edited by RobDog888; Aug 23rd, 2006 at 04:01 PM.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width