AnsweredAssumed Answered

PropertyLinkedText

Question asked by Yong Ning on Feb 21, 2016

5.jpg

 

Private Sub l2()

   Dim oDict As New Dictionary

   Dim Xls As Excel.Application, Rng As Range

       Set Xls = GetObject(, "Excel.Application")

       Set Rng = Xls.Selection

   Dim Sht As Worksheet, Row

       Row = 4

       Set Sht = Rng.Parent

   Dim SwApp As SldWorks.SldWorks, SwModel As ModelDoc2

       Set SwApp = Application.SldWorks

       Set SwModel = SwApp.ActiveDoc

   Dim SwDraw As DrawingDoc

       Set SwDraw = SwModel

   Dim vSheet, SwSheet As Sheet, SwNote As Note

   Dim SwView As View

       vSheet = SwDraw.GetSheetNames

       For ii = 0 To UBound(vSheet)

           SwDraw.ActivateSheet vSheet(ii)

           Set SwSheet = SwDraw.GetCurrentSheet

           Set SwView = SwDraw.GetFirstView

           Do While Not SwView Is Nothing

             

               Set SwNote = SwView.GetFirstNote

               Do While Not SwNote Is Nothing

                   oDict(SwNote.GetName) = SwNote.PropertyLinkedText

                 

                   Set SwNote = SwNote.GetNext

                 

               Loop

               'Row = Row + 1

               Set SwView = SwView.GetNextView

           Loop

       Next ii

       Stop

       For ii = 0 To oDict.Count - 1

         

           Sht.Cells(Row, 1) = oDict.Keys(ii)

           Sht.Cells(Row, 2) = oDict.Items(ii)

           Row = Row + 1

       Next ii

 

End Sub

 

*********************

 

 

 

Private Sub l3()

   Dim Xls As Excel.Application, Rng As Range

       Set Xls = GetObject(, "Excel.Application")

       Set Rng = Xls.Selection

   Dim SwApp As SldWorks.SldWorks, SwModel As ModelDoc2

       Set SwApp = Application.SldWorks

       Set SwModel = SwApp.ActiveDoc

   Dim SwDraw As DrawingDoc

       Set SwDraw = SwModel

  

   Dim vSheet, SwSheet As Sheet

   Dim SwView As View, SwNote As Note

       vSheet = SwDraw.GetSheetNames

       For ii = 0 To UBound(vSheet)

           SwDraw.ActivateSheet vSheet(ii)

           Set SwView = SwDraw.GetFirstView

           Set SwNote = SwView.GetFirstNote

           Do While Not SwNote Is Nothing

               For jj = 1 To Rng.Rows.Count

                  If SwNote.GetName = Rng(jj, 1) Then

                     Debug.Print SwNote.GetText, SwNote.GetName ', SwSheet.GetName

                     'Stop

                     SwNote.SetText Rng(jj, 2)

                  End If

               Next jj

               Set SwNote = SwNote.GetNext

           Loop

       Next ii

End Sub

Attachments

Outcomes