2 Replies Latest reply on Nov 14, 2016 10:57 PM by Mr Omkar Deshpande

    Design Table API / Macro

    Joe Pickens

      Is there a way to access a sheet2 on a design table using API Macros.

       

      In my macro i have these lines of code accessing the design table. but it only allows me to access Sheet1 with myDesignTable.Worksheet but i want to access sheet2 as well.

       

      Set myDesignTable = designTableDoc.GetDesignTable()

       

      If Not myDesignTable Is Nothing Then

          myDesignTable.Attach

        • Re: Design Table API / Macro
          Artem Taturevych

          Try something like that (haven't tested):

           

          myDesignTable.Worksheet.Parent.Worksheets("sheet2")

           

          IWorksheet::Parent should return the pointer to IWorkbook which you can use to access all worksheets.

          • Re: Design Table API / Macro
            Mr Omkar Deshpande

            What i generally do=>

             

            Set swDesTable = swModel.GetDesignTable

            swDesTable.EditTable2 True

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

            Set xlWork = xlApp.ActiveWorkbook

            Set xlSheet = xlWork.ActiveSheet

             

            This enables you to access the design table as a normal excel sheet & you can do whatever you want. Like, if you want to access Sheet2, you can use

             

            Set xlSheet = xlWork.Sheets("Sheet2")

             

            Note: Don't forget to add Microsoft Excel 14.0 Object Reference

             

            Hope, this helps...