Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
WCrihfield
in reply to: f_calebh

You can insert this block of code in there right after defining the oSheet variable, to check for a pre-existing custom table.  If it finds it, it will let you know, and ask you if you want to replace the existing one.  If you say 'Yes', it will delete the existing one, then continue with the rest of the code to create a new one.  If you say 'No', it will exit the code.

 

Dim oExists As Boolean 'false by default
If oSheet.CustomTables.Count > 0 Then
	For Each oCTbl As CustomTable In oSheet.CustomTables
		If oCTbl.Title = "REVISION HISTORY - LEGACY" Then
			oExists = True
			oAns = MsgBox("That Custom Table already exists." & vbCrLf & _
			"Do you want to replace it?", vbYesNo + vbQuestion, "Custom Table Exists")
			If oAns = vbYes Then
				oCTbl.Delete
			ElseIf oAns = vbNo Then
				Exit Sub
			End If
		End If
	Next
End If

 

Also, to make this work, change the following line lower in the main code:

 

Dim oTitle As String = oRevTbl.Title

 

To:

 

Dim oTitle As String = "REVISION HISTORY - LEGACY"

(which you already did)

 

 

If this solved your problem, or answered your question, please click ACCEPT SOLUTION.
Or, if this helped you, please click (LIKE or KUDOS) :thumbs_up:.

If you want and have time, I would appreciate your Vote(s) for My IDEAS :light_bulb:or you can Explore My CONTRIBUTIONS

Wesley Crihfield

EESignature

(Not an Autodesk Employee)