View Single Post
  #4   Report Post  
Posted to microsoft.public.word.newusers
Jay Freedman Jay Freedman is offline
external usenet poster
 
Posts: 9,854
Default Displaying document settings

Sesquipedalian Sam wrote:
On Sun, 07 Feb 2010 21:34:15 -0500, Jay Freedman
wrote:

On Sun, 07 Feb 2010 17:33:54 -0800, Sesquipedalian Sam
wrote:

Is there any way to display the various document settings in the
body of the document so that they print?

I'm referring to paper size, orientation, margins, etc.


There's nothing built in for that (you can set an option to print
document properties, but that's the information in the File
Properties dialog, not the things you mentioned).

A macro could collect the information and add it to the document. But
there's a problem: Those settings are on a per-section basis, and
many others are on a per-paragraph or per-character basis. If the
document isn't uniform throughout, what would you want it to print
in the summary?


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 FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.