Hi,
You can get the Project file path like this:
Dim oDesignProjectMgr As DesignProjectManager = inventorApplication.DesignProjectManager
Dim ipjFilePath as String = oDesignProjectMgr.ActiveDesignProject.FullFileName
Dim ipjFolderPath as String = System.IO.Path.GetDirectoryName(ipjFilePath)
Dim sXLDoc As String = ipjFolderPath & "\BOM.xlsx"
You should use your inventor application object at line 1 for "inventorApplication". If you are using VBA its "ThisApplication".
"ipjFolderPath" is the path that you need.
I recommend you check if the file already exists in desired location, before save the file. If there is a file with same name it will be an error. You can check it manually also. But you want to check it programmitically here is the code:
Dim oDesignProjectMgr As DesignProjectManager = inventorApplication.DesignProjectManager
Dim ipjFilePath as String = oDesignProjectMgr.ActiveDesignProject.FullFileName
Dim ipjFolderPath as String = System.IO.Path.GetDirectoryName(ipjFilePath)
Dim sXLDoc As String = ipjFolderPath & "\BOM.xlsx"
If System.IO.File.Exists(sXLDoc) Then
'The file exists Do something else
Else
'the file doesn't exist So you are safe
End If
I hope this will solve your problem.
Devrim
If my answer is solved your problem, please mark it as Solution
Freundliche Grüße / Kind Regards