Public Sub ToSheet_Example()
 
    Dim vsoShapes As Visio.Shapes 
    Dim vsoShape As Visio.Shape 
    Dim vsoConnectTo As Visio.Shape 
    Dim vsoConnects As Visio.Connects 
    Dim vsoConnect As Visio.Connect 
    Dim intCurrentShapeIndex As Integer
    Dim intCounter As Integer
    Set vsoShapes = ActivePage.Shapes
 
    'For each shape on the page, get its connections.
    For intCurrentShapeIndex = 1 To vsoShapes.Count         Set vsoShape = vsoShapes(intCurrentShapeIndex) 
        Set vsoConnects = vsoShape.Connects         'For each connection, get the shape it connects to.
        For intCounter = 1 To vsoConnects.Count             Set vsoConnect = vsoConnects(intCounter) 
            Set vsoConnectTo = vsoConnect.ToSheet             'Print the name of the shape the 
            'Connect object connects to. 
            Debug.Print vsoConnectTo.Name         Next intCounter     Next intCurrentShapeIndex
 
End Sub
 

解决方案 »

  1.   


    void ToSheet_Example(){
     
      Visio.Shapes vsoShapes;
      Visio.Shape vsoShape;
      Visio.Shape vsoConnectTo;
      Visio.Connects vsoConnects;  
      Visio.Connect vsoConnect ;
      int intCurrentShapeIndex;
      int intCounter;
      vsoShapes = ActivePage.Shapes;
     
      //For each shape on the page, get its connections.
      for(intCurrentShapeIndex = 1;intCurrentShapeIndex <=vsoShapes.Count;intCurrentShapeIndex ++)
    {  vsoShape = vsoShapes(intCurrentShapeIndex) ;
      vsoConnects = vsoShape.Connects ;  //For each connection, get the shape it connects to.
      for(intCounter = 1; intCounter <=vsoConnects.Count ;intCounter ++)
      {  vsoConnect = vsoConnects(intCounter) ;
      vsoConnectTo = vsoConnect.ToSheet ;  //Print the name of the shape the 
      //Connect object connects to. 
      Console.WriteLine(vsoConnectTo.Name);   }  }
     
    }
     
      

  2.   

    vsoConnects(intCounter),vsoShapes(intCurrentShapeIndex)两处提示是变量但是当成了方法是用哈