Sesquipedalian said:
It's a one-page document that I am using to test how various settings
appear on the printed page, especially for custom size paper. I have
two printers and they handle odd-size paper differently.
Could you post a snippet of a macro that would put the following
settings somewhere on the page?
Orientation setting (Portrait or Landscape)
Paper size (Letter/Custom/??? Width, Height)
Margins (Top, Bottom, Left, Right)
Thanks
With those restrictions, you can use (or modify) this:
Sub DocLayout()
Dim outStr As String
With ActiveDocument
outStr = .FullName & vbCr & vbCr
With .PageSetup
outStr = outStr & "Orientation:" & vbTab
If .Orientation = wdOrientPortrait Then
outStr = outStr & "Portrait" & vbCr
Else
outStr = outStr & "Landscape" & vbCr
End If
outStr = outStr & "Paper size:" & vbTab
If .PaperSize = wdPaperCustom Then
outStr = outStr & "Custom, "
outStr = outStr & PointsToInches(.PageHeight)
outStr = outStr & """ x "
outStr = outStr & PointsToInches(.PageWidth)
outStr = outStr & """" & vbCr
Else
outStr = outStr & StandardSize & vbCr
End If
outStr = outStr & "Margins:" & vbTab
outStr = outStr & "Top" & vbTab & vbTab & _
PointsToInches(.TopMargin) & """" & _
vbCr & vbTab & vbTab
outStr = outStr & "Bottom" & vbTab & _
PointsToInches(.BottomMargin) & """" & _
vbCr & vbTab & vbTab
outStr = outStr & "Left" & vbTab & vbTab & _
PointsToInches(.LeftMargin) & """" & _
vbCr & vbTab & vbTab
outStr = outStr & "Right" & vbTab & vbTab & _
PointsToInches(.RightMargin) & """" & vbCr
End With
.Range.InsertAfter outStr
End With
End Sub
Private Function StandardSize() As String
Dim ret As String
Select Case ActiveDocument.PageSetup.PaperSize
Case wdPaper10x14
ret = "Standard 10 x 14 inches"
Case wdPaper11x17
ret = "Standard 11 x 17 inches"
Case wdPaperLegal
ret = "Legal"
Case wdPaperLetter
ret = "Letter"
Case wdPaperA3
ret = "A3"
Case wdPaperA4
ret = "A4"
Case wdPaperA5
ret = "A5"
Case wdPaperTabloid
ret = "Tabloid"
Case Else
ret = "Other (" & ActiveDocument.PageSetup.PaperSize & ")"
End Select
StandardSize = ret
End Function
--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.