Determining units used in page layout via VBA

I'm using Visio as a GUI sketch tool for a control system and I am needing to update the VBA code for a new project. The old project we hard coded the units into a calculation subroutine. This new project required us to use a different unit (Centimeters) and I would like the code to be flexible enough to work with any future project and use whatever units the Page Layout is using.

Is there a way to get this information programmatically?  I've tried looking at the ShapeSheet data for the page but it has "1 cm" for PageScale and DrawingScale.  My code currently uses visPoints for the calculation (See below):

  ' Get page dimensions
  X_PageDim = shpPage.Cells("PageWidth").Result(visPoints)
  Y_PageDim = shpPage.Cells("PageHeight").Result(visPoints)
  
  ' Get object position
  X_Pos = shp.CellsU("PinX").Result(visPoints)
  Y_Pos = shp.CellsU("PinY").Result(visPoints)

In place of the visPoints I would like to place a variable that is filled with the units used by the Page Layout so that the calculations will be accurate.

Any ideas?

July 24th, 2015 12:10pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics