
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am trying to create a VBA macro to copy al of the files referenced in the active document to a new location.
Some similar Apprentice examples use the Inventor.FileSaveAs to collect all of the references before executing the save as but I cannot get it to work.
Here is my code limited to just the current document for testing purposes:
it fails at: Call oFileSaveAs.AddFileToSave(oDoc, sTargetFile)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
' Set references to active document, Target Directory, Filename.
Dim oDoc As Inventor.Document
Set oDoc = ThisApplication.ActiveDocument
Dim sFullFileName As String
sFullFileName = oDoc.FullFileName
Dim sFilename As String
sFilename = Right(sFullFileName, Len(sFullFileName) - InStrRev(sFullFileName, "\"))
' Set Target Directory & Filename
Dim sTargetDir As String
sTargetDir = "C:\Test\"
Dim sTargetFile As String
sTargetFile = sTargetDir & sFilename
' Set a reference to the FileSaveAs object.
Dim oFileSaveAs As Inventor.fileSaveAs
Call oFileSaveAs.AddFileToSave(oDoc, sTargetFile)
Call oFileSaveAs.ExecuteSave
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Any help would be appreciated.
Alasdair
References used:
http://www.mcadforums.com/forums/viewtopic.php?f=15&t=12087&p=84255&hilit=filesaveas#p84255
SDK sample: C:\Users\Public\Documents\Autodesk\Inventor 2013\SDK\UserTools\CopyDesign\Source\form1.vb
Solved! Go to Solution.