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

Hi, looks like you used wrong format of filename written into SaveAs function. It must be the full file name, including directory name, file name and extension, not just name of new assembly. I would recommend using Inventor.FileDialog to avoid such mistakes.

Dim oFileDlg As Inventor.FileDialog = Nothing
InventorVb.Application.CreateFileDialog(oFileDlg)
oFileDlg.CancelError = False
oFileDlg.MultiSelectEnabled = False
oFileDlg.Filter = "IAM file (*.iam)|*.iam"
oFileDlg.DialogTitle = "Save assembly as"
oFileDlg.InitialDirectory = IO.Path.GetDirectoryName(ThisApplication.ActiveDocument.FullFileName)
oFileDlg.ShowSave()
If oFileDlg.FileName <> "" Then
	newFileName = oFileDlg.FileName
Else
	Exit Sub
End If

Dim originalAssembly As AssemblyDocument
originalAssembly = ThisApplication.ActiveDocument
originalAssembly.SaveAs(newFileName, True)