LucasC
Automotive
- Feb 18, 2019
- 157
I'm trying to apply changes to a revision column on multiple sheet of 1 drawing. If the "apply to all sheets" toggle is on, it performs that action when, a separate, "apply changes" command button is clicked.
What I need help with is which method I should use to loop through each sheet and apply the change. I've tried Do..While, Do, For..each.
Also I don't understand this:
Sheetcount = DrawingDoc.sheets.Count (3 sheets in my test drawing)
Dim SheetIndex As Integer
For SheetIndex = 1 To SheetCount Step 1
Next
SheetIndex now has a value 4??? why? where did the extra integer come from? MS docs says this should = 1 2 3.
What I need help with is which method I should use to loop through each sheet and apply the change. I've tried Do..While, Do, For..each.
Also I don't understand this:
Sheetcount = DrawingDoc.sheets.Count (3 sheets in my test drawing)
Dim SheetIndex As Integer
For SheetIndex = 1 To SheetCount Step 1
Next
SheetIndex now has a value 4??? why? where did the extra integer come from? MS docs says this should = 1 2 3.
Code:
Dim DrawingDoc As DrawingDocument
Set DrawingDoc = CATIA.ActiveDocument
Dim DrawingSheet As DrawingSheets
Set DrawingSheet = DrawingDoc.sheets
Dim sheet As Integer
Dim SheetCount As Integer
[COLOR=#4E9A06]'sheet = sheet + 1[/color]
SheetCount = DrawingDoc.sheets.Count
If ApplyToAll.Value = True Then
Dim SheetIndex As Integer
For SheetIndex = 1 To SheetCount Step 1
Next
Do Until SheetIndex = SheetCount
DrawingSheet.Item(SheetIndex).Activate
[COLOR=#4E9A06]'SheetCount is registering a correct value[/color]