0 Replies Latest reply on Feb 24, 2015 9:58 AM by Yong Ning

    How to connect the Design Table (Excel) with API

    Yong Ning

      0.jpg

       

      Hope connect Design Table with Api ?

       

       

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

      Private Sub ll1()

        Dim Xls As Excel.Application, Rng As Range

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

          Set Rng = Xls.Selection

        

        Dim Path, FileName, Wk As Workbook, oRng As Range

        

        

        Dim SwApp As SldWorks.SldWorks, SwModel As ModelDoc2

          Set SwApp = Application.SldWorks

          Set SwModel = SwApp.ActiveDoc

         Dim SwOleObj As SwOLEObject, vOle, vv As Long

         vOle = SwModel.Extension.GetOLEObjects(vv)

         Set SwOleObj = vOle(1)

         Set Wk = SwOleObj.SetActive(True)

          ''

          Set oRng = Wk.Sheets(1).Range("A2:Z1000")

          oRng.Clear

          Rng.Copy

          oRng.PasteSpecial xlPasteValues

          oRng.Font.Size = 9

          Stop

          SwOleObj.SetActive False

          SwModel.ForceRebuild3 True

          ''

        Dim SwDesgTab As DesignTable

          Set SwDesgTab = SwModel.GetDesignTable

          Stop

          With SwDesgTab

             .Attach

             Stop

             .Detach

          End With

      End Sub