0 Replies Latest reply: Mar 1, 2013 5:25 AM by Micael Leal RSS

    Access Sheet & Object VBS



      I was looking around how to switch between sheets and how to access individual object.


      Hope this might help a bit.


      Sub Loop_Sheets_And_Objects

          'loop through all sheets

          for i = 0 to ActiveDocument.NoOfSheets - 1

              'Switching between Sheets



              set s=ActiveDocument.Sheets(ActiveDocument.Sheets(i).GetProperties.Name)


              for j=0 to orignumber-1

                   rem ** get unique object ID for given object on sheet **

                   set so = s.SheetObjects(j)


                   id = so.GetObjectId

                   'msgbox("ID = " & id)

                   'Access on specific Object Id

                   IF id="Document\T_DAILY_SUM" THEN

                       msgbox("Access on a table")

                   END IF



      End Sub