How to display description of value instead of this value?

A

avkokin

Hello.
There is the code that display information about of paper size:
Sub currentsize()
Dim ps As String
ps = Selection.PageSetup.PaperSize
msgbox ps
End Sub
But it show in the number. I want to see description thouse. That is
instead of "7" (for example) I want to see description that. How?
Thank you.
 
S

StevenM

To: Avkokin,

Sub PaperSize()
Dim pWidth As Long
Dim pHeight As Long

pWidth = ActiveDocument.PageSetup.PageWidth
pHeight = ActiveDocument.PageSetup.PageHeight

MsgBox "Page Width: " & PointsToPicas(pWidth) & " picas or " _
& PointsToInches(pWidth) & " inches" & vbCr _
& "Page Height: " & PointsToPicas(pHeight) & " picas or " _
& PointsToInches(pHeight) & " inches"
End Sub

Steven Craig Miller
 
A

avkokin

Hello Steven. Thank you very much. But I meaned other result. Sorry
for my circuitous manner of describing. I meaned display not
dimensions, but page format, i.e. not 8,26 inches e.g. but constants
A4 or other format that correspond to current paper size.
Gratitude!
 
S

StevenM

To: Avkokin.

Okay, how about this? (The long line of names will need to be straighten out.)

Sub TestReturnNameOfPaperSizes()
MsgBox ReturnNameOfPaperSizes(wdPaperA4)
MsgBox ReturnNameOfPaperSizes(wdPaperTabloid)
End Sub

Function ReturnNameOfPaperSizes(ByVal iValue As Integer) As String
Const sPaperSizes As String = "Paper10x14, Paper11x17, PaperLetter,
PaperLetterSmall, PaperLegal, PaperExecutive, PaperA3, PaperA4, PaperA4Small,
PaperA5, PaperB4, PaperB5, PaperCSheet, PaperDSheet, PaperESheet,
PaperFanfoldLegalGerman, PaperFanfoldStdGerman, PaperFanfoldUS, PaperFolio,
PaperLedger, PaperNote, PaperQuarto, PaperStatement, PaperTabloid,
PaperEnvelope9, PaperEnvelope10, PaperEnvelope11, PaperEnvelope12,
PaperEnvelope14, PaperEnvelopeB4, PaperEnvelopeB5, PaperEnvelopeB6,
PaperEnvelopeC3, PaperEnvelopeC4, PaperEnvelopeC5, PaperEnvelopeC6,
PaperEnvelopeC65, PaperEnvelopeDL, PaperEnvelopeItaly, PaperEnvelopeMonarch,
PaperEnvelopePersonal, PaperCustom"
Dim vList As Variant
vList = Split(sPaperSizes, ", ")
If iValue >= LBound(vList) And iValue <= UBound(vList) Then
ReturnNameOfPaperSizes = vList(iValue)
End If
End Function

I'm using Word 2000, it is possible that they have added others to this list.

Steven Craig Miller
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top