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

I got a workaround to my problem by using ThisApplication.CommandManager..ControlDefinitions.Item("AppFileSaveAsCmd") to run the "SaveAs" command instead of ThisDoc.Document.SaveAs()

 

The idea was to make a "Smart SaveAs" rule in a drawing document which would auto-populate the saveas dialog with PartNumber - RefModelFilename.idw to save time when saving a lot of drawings.

 

As a workaround, my code uses the clipboard instead:

 

Dim openDoc As Document
openDoc = ThisDoc.Document

'Look at the model file referenced in the open document
Dim docFile As Document
If ThisDoc.ModelDocument IsNot Nothing Then
docFile = ThisDoc.ModelDocument
Else
MessageBox.Show("This drawing has no model reference", "iLogic")
Return
End If
    
'format model file name                   
Dim FNamePos As Long
FNamePos = InStrRev(docFile.FullFileName, "\", -1)                        
Dim docFName As String 
docFName = Right(docFile.FullFileName, Len(docFile.FullFileName) - FNamePos) 
'remove Extension
Dim docFNameSimple As String 
docFNameSimple = Left(docFName, Len(docFName) - 4) 

ModelPartNumber = iProperties.Value(docFName, "Project", "Part Number")
'ModelDescription = StrConv(iProperties.Value(docFName, "Project", "Description"), VbStrConv.ProperCase)'ModelTitle = StrConv(iProperties.Value(docFName, "Summary", "Title"), VbStrConv.ProperCase)'ModelSubject = StrConv(iProperties.Value(docFName, "Summary", "Subject"), VbStrConv.ProperCase)

AutoFilename = ModelPartNumber & " - " & docFNameSimple
Clipboard.SetText(AutoFilename)

ThisApplication.UserInterfaceManager.UserInteractionDisabled = False

Dim oCommandMgr As CommandManager
oCommandMgr = ThisApplication.CommandManager

Dim oDef As ControlDefinition
oDef = oCommandMgr.ControlDefinitions.Item("AppFileSaveAsCmd")

oDef.Execute2(False)

 

Still it would be nice to know if there is a way to get the last saved file location in iLogic.