Word

Default Page Setup Setter

Ease of Use

Easy

Version tested with

2000 

Submitted by:

johnske

Description:

On opening a NEW Office Doc you're offered the option of "your usual page set-up?" on choosing YES - margins, font, view, etc are all changed and saved. If you choose NO the option is still available of running the set-up at any time thereafter. 

Discussion:

You may be in a hurry and opt for the Office default page setup initially, but may later decide you want to use your usual setup - run the macro "SetupPage" and it shall be done. 

Code:

instructions for use

			

Private Sub Document_New() Dim Answer As VbMsgBoxResult Answer = MsgBox("Do you want your usual page setup?", vbYesNo) If Answer = vbNo Then Exit Sub Else SetupPage End Sub Sub SetupPage() '//change/add to the preferences below to suit yourself Application.WindowState = wdWindowStateNormal ActiveDocument.ActiveWindow.View.Zoom.PageFit = wdPageFitBestFit Set MyRange = Selection.Range MyRange.WholeStory MyRange.Font.Name = "Verdana" With ActiveDocument.PageSetup .Orientation = wdOrientPortrait .TopMargin = InchesToPoints(0.6) .BottomMargin = InchesToPoints(0.97) .LeftMargin = InchesToPoints(0.6) .RightMargin = InchesToPoints(0.6) .PageWidth = InchesToPoints(8.27) .PageHeight = InchesToPoints(11.69) ActiveDocument.Save End With MsgBox ("All done - And saved! :o)") End Sub

How to use:

  1. Open any Word doc on your PC:
  2. Select Tools/Macro/Visual Basic Editor
  3. In the VBE window, select View/Project Explorer
  4. In the Project Explorer pane, select Normal/Microsoft Word Object/ThisDocument
  5. Copy and paste the code in "ThisDocument"
  6. In the VBE window, select File/Close and Return To Microsoft Word
  7. Now select Tools/Macro/Macros/SetupPage/Run
  8. On opening any new office documents you will now be prompted with "Do you want your usual page setup?" (you choose)
 

Test the code:

  1. Type some text into a word doc using Times New Roman, select Tools/Macro/Macros/SetupPage/Run and watch for the changes to your text and page setup
  2. Go to Start/New Office Document/New document double-click and select Yes
 

Sample File:

No Attachment 

Approved by Anne Troy


This entry has been viewed 105 times.

Please read our Legal Information and Privacy Policy
Copyright @2004 - 2020 VBA Express