Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Formatting the page?

Formatting the page?

Formatting the page?

How can i format only the page being viewed currently?

 I have figured out how to format the entire document....but this takes a large amount of time.

This is the code i have now (Like i said, it formats all pages)

Application.ActiveDocument.PaperSize = visPaperSizeA3
Application.ActiveDocument.PrintFitOnPages = True
Application.ActiveDocument.PrintLandscape = True
Application.ActiveDocument.PrintPagesAcross = 1
Application.ActiveDocument.PrintPagesDown = 1

I cannot find a way to do the exact same thing but to ONLY the page currently being viewed. Any ideas?

RE: Formatting the page?

You are working at teh document level and should be working at the page level. Unfortunately, the page level does not have the nice properties of the document level and you will have to change the properties as cells.

So you need to use ActivePage.

Here is some sample code for changing the page height and width. Landscape / Portrait are not needed because H/W defines which one it is. To find other options, use the macro recorder.

Public Sub PageSize()

' This routine will change the paper size
Debug.Print ActivePage.Shapes("thePage").Cells("PageWidth")
Debug.Print ActivePage.Shapes("thePage").Cells("PageHeight")

ActivePage.Shapes("thePage").Cells("PageWidth").Formula = 7.5
ActivePage.Shapes("thePage").Cells("PageHeight").Formula = 15

Debug.Print ActivePage.Shapes("thePage").Cells("PageWidth")
Debug.Print ActivePage.Shapes("thePage").Cells("PageHeight")

ActivePage.Shapes("thePage").Cells("PageWidth").Formula = 8.5
ActivePage.Shapes("thePage").Cells("PageHeight").Formula = 11

Debug.Print ActivePage.Shapes("thePage").Cells("PageWidth")
Debug.Print ActivePage.Shapes("thePage").Cells("PageHeight")

End Sub

John...   Visio MVP - Visio.MVPs.org

RE: Formatting the page?

Actually, this code here seems to work fine.

On Error GoTo 10
Dim UndoScopeID1 As Long
UndoScopeID1 = Application.BeginUndoScope("Page Setup")
Application.ActivePage.Background = False
Application.ActivePage.PageSheet.CellsSRC(visSectionObject, visRowPrintProperties, visPrintPropertiesOnPage).FormulaU = "1"
Application.EndUndoScope UndoScopeID1, True
Application.ActiveDocument.PrintOut visPrintFromTo, Application.ActivePage.Index, Application.ActivePage.Index, , , , , 1
Exit Sub
Whoops = MsgBox("An error has occured!", vbCritical + vbOKOnly)

RE: Formatting the page?

Any line with UnDoscope is unnecessary. That code is added by the macro recorder so that changes could be backed out. A more judicious placement of the code can be determined by the user. (at the beginning or the end).
Also the "Application." can also be removed.

John...   Visio MVP - Visio.MVPs.org

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close