get and set drawing scale programmatically

T

Tomislav

Hello,

how to get and set drawing scale in Visio by using Visio VBA ?

thanks,

Tomislav
 
A

Al Edlund

you might try something like this

al


' We want to copy page formats to target pages for a number of reasons
' which include common looks as well as maintaining integrity of copied
' pages.

Private Function funcCopyPageFormat(tgtPage As Visio.Page, srcPage As
Visio.Page) As Boolean

Dim tgtPageSheet As Visio.Shape
Dim srcPageSheet As Visio.Shape

On Error GoTo CopyPageFormat_Err

Set tgtPageSheet = tgtPage.PageSheet
Set srcPageSheet = srcPage.PageSheet


tgtPageSheet.Cells("DrawingSizeType").FormulaU =
srcPageSheet.Cells("DrawingSizeType").FormulaU
tgtPageSheet.Cells("DrawingScaleType").FormulaU =
srcPageSheet.Cells("DrawingScaleType").FormulaU
tgtPageSheet.Cells("DrawingScale").FormulaU =
srcPageSheet.Cells("DrawingScale").FormulaU
tgtPageSheet.Cells("PageScale").FormulaU =
srcPageSheet.Cells("PageScale").FormulaU
tgtPageSheet.Cells("PageWidth").FormulaU =
srcPageSheet.Cells("PageWidth").FormulaU
tgtPageSheet.Cells("PageHeight").FormulaU =
srcPageSheet.Cells("PageHeight").FormulaU
tgtPageSheet.Cells("RouteStyle").FormulaU =
srcPageSheet.Cells("RouteStyle").FormulaU

funcCopyPageFormat = True

CopyPageFormat_Exit:
DoEvents
Exit Function

CopyPageFormat_Err:

Debug.Print "Error CopyPageFormat " & Err.Number & ": " &
Err.Description
funcCopyPageFormat = False
Resume CopyPageFormat_Exit

End Function
 
J

JuneTheSecond

Drawing scale is defined by the ratio of PageScale and DrawingScale.
They are found at the page properties section in the shapesheet of a page.
 

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