Change page size from Letter to Legal

B

Barry

Hello,

I am attempting to change my page size from Letter to Legal with the
following code using VB.NET:

vApp = New Visio.Application
vDoc = vApp.Documents.Add("")
vDoc.PaperSize = Visio.VisPaperSizes.visPaperSizeLegal

When I start to debug my code, I can see in Visio that the page size is now
Legal, however the actual canvas is still letter. If I pause the debugger and
go into Page Setup select Page Size and click the option 'Same as printer
paper size' and hit OK, my viewable canvas is not Legal.

I am sure I am missing more code, but can't seem to find anything! I recored
a Macro to see what the VB code looked like, but that didn't help much.


Thanks!
Barry
 
P

Paul Herber

Hello,

I am attempting to change my page size from Letter to Legal with the
following code using VB.NET:

vApp = New Visio.Application
vDoc = vApp.Documents.Add("")
vDoc.PaperSize = Visio.VisPaperSizes.visPaperSizeLegal

When I start to debug my code, I can see in Visio that the page size is now
Legal, however the actual canvas is still letter. If I pause the debugger and
go into Page Setup select Page Size and click the option 'Same as printer
paper size' and hit OK, my viewable canvas is not Legal.

I am sure I am missing more code, but can't seem to find anything! I recored
a Macro to see what the VB code looked like, but that didn't help much.

Application.ActivePage.PageSheet.CellsSRC(visSectionObject,
visRowPage, visPageWidth).FormulaU = "8.5 in"
Application.ActivePage.PageSheet.CellsSRC(visSectionObject,
visRowPage, visPageHeight).FormulaU = "14 in"
Application.ActivePage.PageSheet.CellsSRC(visSectionObject,
visRowPrintProperties, visPrintPropertiesPaperKind).FormulaU = "5"
 
B

Barry

Thanks Paul, that got me on the right track. What I needed was to find out
where these constants were defined in the Visio object: I couldn't find the
last value, but managed to get the other ones!

currentPage = vDoc.Application.ActivePage()

currentPage.PageSheet.CellsSRC(Visio.VisSectionIndices.visSectionObject,
Visio.VisRowIndices.visRowPage, 0).FormulaU = "8.5 in" '0 = width

currentPage.PageSheet.CellsSRC(Visio.VisSectionIndices.visSectionObject,
Visio.VisRowIndices.visRowPage, 1).FormulaU = "14 in" '1 = height

currentPage.PageSheet.CellsSRC(Visio.VisSectionIndices.visSectionObject,
Visio.VisRowIndices.visRowPrintProperties, 17).FormulaU = "5" '17 = paper
type


Barry
 
P

Paul Herber

Thanks Paul, that got me on the right track. What I needed was to find out
where these constants were defined in the Visio object: I couldn't find the
last value, but managed to get the other ones!

currentPage = vDoc.Application.ActivePage()

currentPage.PageSheet.CellsSRC(Visio.VisSectionIndices.visSectionObject,
Visio.VisRowIndices.visRowPage, 0).FormulaU = "8.5 in" '0 = width

currentPage.PageSheet.CellsSRC(Visio.VisSectionIndices.visSectionObject,
Visio.VisRowIndices.visRowPage, 1).FormulaU = "14 in" '1 = height

currentPage.PageSheet.CellsSRC(Visio.VisSectionIndices.visSectionObject,
Visio.VisRowIndices.visRowPrintProperties, 17).FormulaU = "5" '17 = paper
type

the cell names in that section are
visPageWidth
visPageHeight
visPageScale
visPageDrawingScale
visPageShdwOffsetX
visPageShdwOffsetY
visPageDrawSizeType
visPageDrawScaleType
visPageInhibitSnap
 

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