I'm trying to make a msgbox display when a named table(there are multiple tables i'm looping through) is not found on a V5 drawing. if the correct table is found a user form launches.
I had everything working when just using an item index but wanted to add the loop just in case another table is added in the future. Can anyone point out where I went off the road and crashed in the ditch?
I had everything working when just using an item index but wanted to add the loop just in case another table is added in the future. Can anyone point out where I went off the road and crashed in the ditch?
Code:
'check if correct frame is used
Dim DrawingTables As DrawingTables
Set DrawingTables = drawingDocument1.sheets.ActiveSheet.views.Item("Background View").Tables
Dim I As Integer
For I = 1 To DrawingTables.Count
Dim TableName As DrawingTable
Set TableName = DrawingTables.Item(I)
Next
For Each TableName In DrawingTables
If TableName.Name = "Revision_Text_Table" Then
Revisions.Show vbModeless
End If
Next
[COLOR=#73D216]'code operates as expected to this point[/color]
[COLOR=#4E9A06]
'I tried the below string compare, if <> then, and if is not then. I added the for each loop thinking that I might need it in order to solve the code.[/color]
For Each TableName In DrawingTables
If StrComp(TableName.Name, "Revision_Text_Table") = Null Then
MsgBox ("Current Drawing Frame Not Compatible With Macro.") & vbNewLine & ("Replace Sheet Background Or Check Table Names ."), vbInformation
Exit Sub
End If
Next
End Sub