How to find Page "Measurement Units" in code?

Started by robert.cowham, April 30, 2012, 02:52:37 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

robert.cowham

I am not sure what is the best way to find this out - the user can set a value (in Visio 2010) by right clicking Page tab > Page Setup > Page Properties > MEasurement Units

Valid values range from Inches to Kilometers (and the oddities such as Ciceros etc)

In the shape sheet window for the page, there are cells such as:

DrawingSizeType, DrawingScaleType

But they don't change if I modify Measurement Units (from say Meters to Feet)

Suggestions for best way to find out what the user has done?

saveenr

I tried doing this in Visio 2010 just now.

When brought up the page shapesheet window and the Page Setup dialog. Any changes to Measurement Units in the Page Setup dialog seem to be mirrored in the PageScale, and DrawingScale cells.

For example when I set Measurement Units to "Feet" I saw that the PageScale and DrawingScale were both set to "1 ft" immediately.

robert.cowham

After posting, I realized a variation on a similar idea - hope this sort of thing works:

      Dim units As Short = m_VisioApp.ActivePage.PageSheet.Cells("DrawingScale").Units
        If units = Visio.VisUnitCodes.visMillimeters Or units = Visio.VisUnitCodes.visCentimeters Or _
            units = Visio.VisUnitCodes.visMeters Or units = Visio.VisUnitCodes.visKilometers Then
            ReadPageUnits = "mm"
        Else
            ReadPageUnits = "in"
        End If

I want to use "mm" for metric and "inches" for Imperial. This ignores a whole load of esoteric units such as Ciceros...