2009-01-08 80 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考虑。