The issue I am having is using the API I can get a macro to sometimes delete the table. On some drawings method A works, on some method B, and others nothing works. I suspect it may have something to do with one source template being created in France, but I am not sure. I also have a suspicion that the location of the table may be a factor.
I am NOT a programmer, I am usually able to combine information from here, some faint recollection of VB back in college, and recording some items, then making it work. Usually I am successful, but this one has me stumped.
Method A:
'Captures the item name of the table
sName = swTable.GetAnnotation.GetName & "@Sheet1"
'Deletes the table
Set Part = swApp.ActiveDoc
boolstatus = Part.Extension.SelectByID2(sName, "REVISIONTABLE", 0, 0, 0, False, 0, Nothing, 0)
Part.EditDelete
I have also added the vSheetNames (from method B) to the above to accommodate the sheet name changing, or being in French
Method B (found on web):
vSheetNames = swDraw.GetSheetNames
For i = 0 To UBound(vSheetNames)
swDraw.ActivateSheet vSheetNames(i)
' Debug.Print vSheetNames(i)
Set swSheet = swDraw.GetCurrentSheet
Set RevTableAnn = swSheet.RevisionTable
If Not RevTableAnn Is Nothing Then
' Debug.Print "Revision Table is SOMETHING! Double check for revTableFeat now!"
Set revTableFeat = RevTableAnn.RevisionTableFeature
If revTableFeat Is Nothing Then
' Debug.Print "Revision table feature is nothing but a revision table exists!"
Set swTableAnn = RevTableAnn
Set swAnn = swTableAnn.GetAnnotation
boolstatus = swAnn.Select3(False, swSelData)
bRet = swModelDocExt.DeleteSelection2(swDeleteSelectionOptions_e.swDelete_Absorbed)
Debug.Print "Revision table annotation deleted? " & bRet
Else
' Debug.Print "Revision table feature is present! Delete it!"
Set swFeat = RevTableAnn.RevisionTableFeature.GetFeature
bRet = swFeat.Select2(False, 0)
bRet = swModelDocExt.DeleteSelection2(swDeleteSelectionOptions_e.swDelete_Absorbed)
End If
Else
' Debug.Print "Revision Table is nothing! Sheet can be skipped!"
End If
Next
Method A worked for all of our original sheet formats, but has never worked on the French versions. Method B works on some, and others it does not. I am at a loss. Happy to share more information and items to test with. Would appreciate any help!
Thank you.**
I have tried multiple methods (shown above) as well as recording myself and comparing the data – it looks the same?