2009-01-08 79 views

回答

1

不幸的是沒有一個簡單的方法來做到這一點。您將必須遍歷源表單中的所有行,並在目標表單中創建相同的行。例如: -

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 

如果你需要複製大量的行和性能是您應該調查使用AddRowsSetFormulas考慮。