Hi,
Can anyone take a look at this code and spot why its not working properly..
Basically, its a small section of a main program i wrote to revise up drawings and this section resets the titleblocks back to default settings. The main form has a listbox showing the layouts, so the user can choose whichever layouts they need to revise or reset..
The code for the ONLY SELECTED ONES part of the routine below works fine (click No from the msgbox), but the Yes option (ALL LAYOUTS) will only do the current layout and not loop through them all, as its supposed to..
The ResetTitleBlocks subroutine just cycles through the attributes of the titleblock and changes them to default values..
The code in question is in red. btw, layoutZ is dim'd as an ACAD LAYOUT..
' DELETE REVISION DETAILS..
Private Sub cmdDELETEREVISIONS_Click()
response = MsgBox("Would you like to reset ALL titleblocks or just the selected ones?.." & vbCr & vbCr & "Click Yes to reset ALL layouts or click No to reset only selected layouts..", vbYesNoCancel, "Revision Details Editor..")
If response = vbCancel Then
Exit Sub
End If
If response = vbNo Then
' Loop through the selected layouts..
For Cx = LBound(SelectedLayouts) + 1 To UBound(SelectedLayouts)
ThisDrawing.ActiveLayout = ThisDrawing.Layouts(SelectedLayouts(Cx))
ResetTitleBlocks
Next Cx
GoTo RESETEND
[color=red]ElseIf response = vbYes Then
For Each layoutZ In ThisDrawing.Layouts
ResetTitleBlocks
Next layoutZ[/color]
GoTo RESETEND
End If
RESETEND:
Unload Me
End Sub
Any ideas why its not looping through all the drawing's layouts?