1
是否存在使用VBA將形狀複製到另一個形狀的方法?我特別試圖將所有自定義屬性和用戶單元從一個頁面複製到另一個頁面。如何在VBA中的形狀之間複製Visio形狀表部分
是否存在使用VBA將形狀複製到另一個形狀的方法?我特別試圖將所有自定義屬性和用戶單元從一個頁面複製到另一個頁面。如何在VBA中的形狀之間複製Visio形狀表部分
不幸的是沒有一個簡單的方法來做到這一點。您將必須遍歷源表單中的所有行,並在目標表單中創建相同的行。例如: -
Dim oPageSheet1 As Visio.Shape
Dim oPageSheet2 As Visio.Shape
Dim rowName As String
Dim i As Integer
Set oPageSheet1 = Visio.ActiveDocument.Pages.Item(1).PageSheet
Set oPageSheet2 = Visio.ActiveDocument.Pages.Item(2).PageSheet
i = visRowUser
While oPageSheet1.CellsSRCExists(visSectionUser, i, visUserValue, False)
oPageSheet2.AddNamedRow visSectionUser, oPageSheet1.Section(visSectionUser).Row(i).NameU, 0
oPageSheet2.Section(visSectionUser).Row(i).Name = oPageSheet1.Section(visSectionUser).Row(i).Name
oPageSheet2.CellsSRC(visSectionUser, i, visUserValue).FormulaU = oPageSheet1.CellsSRC(visSectionUser, i, visUserValue).FormulaU
oPageSheet2.CellsSRC(visSectionUser, i, visUserPrompt).FormulaU = oPageSheet1.CellsSRC(visSectionUser, i, visUserPrompt).FormulaU
i = i + 1
Wend
如果你需要複製大量的行和性能是您應該調查使用AddRows和SetFormulas考慮。