VBScript近似Visio的自动适应画布功能

录制的宏太过个性化,无法适应不同画布的内容,可以调整以下代码进行模拟实现。

            Set oVisio = CreateObject("Visio.Application")
            oVisio.ActiveWindow.SelectAll
            Set visSelection = oVisio.ActiveWindow.Selection
            visSelection.Group
            Set visSelection = oVisio.ActiveWindow.Selection
            Set visShape = visSelection(1)
            Dim width, height As Double
            Dim visMillimeters As Integer
            width = visShape.Cells("Width").Result("in")
            height = visShape.Cells("Height").Result("in")
            oVisio.ActivePage.PageSheet.Cells("PageWidth").Formula = width
            oVisio.ActivePage.PageSheet.Cells("PageHeight").Formula = height
            visShape.Ungroup
            Dim visCmdCenterDrawing As Integer
            visCmdCenterDrawing = 1202
            oVisio.DoCmd visCmdCenterDrawing

            oVisio.Quit

你可能感兴趣的:(VBScript近似Visio的自动适应画布功能)