Topic
I have copied a code from Wiki from the above page into a Spread Sheet document that has many sheets.XIndexAccess provides the getByIndex and getCount methods for calling the subordinate objects. getByIndex provides an object with a particular index. getCount returns how many objects are available.
The code appears below, in the REM statement I have pasted what-the-code-is-supposed-to-do
But it stops at the very first line with the following message...could anyone fix it for me.
Object Variable not set
Thanks and RegardsSub Main
REM The example shows a loop that runs through all sheet elements one after another
REM and saves a reference to each in the Sheet object variable.
REM When working with the indexes, note that getCount
REM returns the number of elements. The elements in getByIndex
REM however are numbered beginning with 0.
REM The counting variable of the loop therefore runs from 0 to getCount()-1.
Dim Sheets As Object
Dim Sheet As Object
Dim I As Integer
Sheets = Spreadsheet.Sheets
For I = 0 to Sheets.getCount() - 1
Sheet = Sheets.getByIndex(I)
' Editing sheet
Next I
End Sub
Arun.