Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
How to avoid an error is thrown if titleblockdefinition does not exist?
I could use try catch, on error resume next and so on, but this is a bad practice if you know that something can go wrong (in this case, the titleblockdef is not present)
Sub testtitleblock() Dim oDrawDoc As DrawingDocument Set oDrawDoc = ThisApplication.ActiveDocument If oDrawDoc.TitleBlockDefinitions.Item("Notexistingtitleblockdef") Is Nothing Then MsgBox "not found" End If End Sub
If you think this answer fullfilled your needs, improved your knowledge or leads to a solution,
please feel free to "kudos"
please feel free to "kudos"
Solved! Go to Solution.