2017-05-09 36 views
0

我目前正在嘗試自動整理我已使用page.layout功能以編程方式添加到Visio頁面的形狀。我希望通過GUI來應用圓形佈局。將一個圓形的page.layout應用到Visio

目前我已經通過記錄在Visio宏錄製下面的代碼,輸出:

Dim UndoScopeID1 As Long 
UndoScopeID1 = Application.BeginUndoScope("Lay Out Shapes") 
Application.ActiveWindow.Page.PageSheet.CellsSRC(visSectionObject, visRowPageLayout, visPLOPlaceStyle).FormulaForceU = "6" 
Application.ActiveWindow.Page.PageSheet.CellsSRC(visSectionObject, visRowPageLayout, visPLORouteStyle).FormulaForceU = "16" 
Application.ActiveWindow.Page.Layout 
Application.EndUndoScope UndoScopeID1, True 

我已經轉換這個用在我的VB.NET應用程序如下:

Dim UndoScopeID1 As Long 
    UndoScopeID1 = vApp.BeginUndoScope("Lay Out Shapes") 

    Dim visSectionObject, visRowPageLayout, visPLOPlaceStyle, visPLORouteStyle As String 

    vApp.ActiveWindow.Page.PageSheet.CellsSRC(visSectionObject, visRowPageLayout, visPLOPlaceStyle).FormulaForceU = "6" 
    vApp.ActiveWindow.Page.PageSheet.CellsSRC(visSectionObject, visRowPageLayout, visPLORouteStyle).FormulaForceU = "16" 
    vApp.ActiveWindow.Page.Layout() 
    vApp.EndUndoScope(UndoScopeID1, True) 

注意vApp也已被聲明。

此代碼可以工作,但應用徑向頁面佈局而不是圓形頁面佈局。

有沒有人知道我必須通過visSectionObject,visRowPageLayout,visPLOPlaceStyle,visPLORouteStyle中的值來實際獲取它以輸出圓形頁面佈局?或者有什麼我需要做的。這似乎沒有記錄在任何方便的地方。

回答

1

我發現對於Visio 2003 SDK筆記解釋如何工作的:

與更換變量來自鏈接的索引值很好地工作。的溶液

實施例:

Dim UndoScopeID1 As Long 
UndoScopeID1 = vApp.BeginUndoScope("Lay Out Shapes") 

'vApp.ActiveWindow.Page.PageSheet.CellsSRC(visSectionObject, visRowPageLayout, visPLOPlaceStyle).FormulaForceU = "6" 
'vApp.ActiveWindow.Page.PageSheet.CellsSRC(visSectionObject, visRowPageLayout, visPLORouteStyle).FormulaForceU = "16" 
vApp.ActiveWindow.Page.PageSheet.CellsSRC(1, 24, 8).FormulaForceU = "6" 
vApp.ActiveWindow.Page.PageSheet.CellsSRC(1, 24, 9).FormulaForceU = "16" 
vApp.ActiveWindow.Page.Layout() 
vApp.EndUndoScope(UndoScopeID1, True) 
相關問題