Message 1 of 1
VBA vault UndoCheckoutTop only working once?

Not applicable
07-18-2017
08:46 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have written a macro to open and look through drawings in inventor. I would like it to UndoVaultCheckoutTop for certain drawings which do not require changing however my macro will only undocheckout for the first drawing and does not work the for the subsequent drawings.
Here is a shortened version of code containing the important part.
Dim oDoc As Document For Each oDoc In ThisApplication.Documents.VisibleDocuments If oDoc.DocumentType = kDrawingDocumentObject Then oDoc.Activate ''Sub to look through the drawing End If Next ''In the sub that looks through the drawing ''If unchanged then Set ctrdef = ThisApplication.CommandManager.ControlDefinitions.Item("VaultUndoCheckoutTop") ctrdef.Execute DoEvents invDoc.Close (True) DoEvents ''End if
Each document that is unchanged does get here and is closed as it should be however only the first one has the checkout undone. The rest are closed but remain checked out. Is there any reason that this happens/ how can I fix this?
Thank you.