Attribute VB_Name = "XEXport" Dim sFname As String Dim strFile As String Dim strInputFolder As String Dim strOutputFolder As String 'Connect to a running instance of Inventor. Public Sub XEXport() Dim oApp As Inventor.Application Dim oPartDoc As PartDocument Dim Dateiname As String Dim DateiNr As Integer strInputFolder = "C:\projekte\Input" strOutputFolder = "C:\projekte\Output\" Dateiname = strInputFolder & "Dateiliste.txt" DateiNr = FreeFile On Error Resume Next Set oApp = GetObject(, "Inventor.Application") If Err Then MsgBox "Autodesk Inventor muss vorher geöffnet sein." Exit Sub End If Open Dateiname For Input As DateiNr Do While Not EOF(DateiNr) Line Input #DateiNr, strFile Set oPartDoc = oApp.Documents.Open(strInputFolder + strFile, True) 'fit part to view oApp.ActiveView.Fit Call Change_to_Export oApp.ActiveDocument.Close (True) Loop Close DateiNr End Sub Public Sub Change_to_Export() ' Set reference to active document. Dim oDoc As Inventor.Document Set oDoc = ThisApplication.ActiveDocument Dim strFiletype As String strFiletype = "sat" ' Check the Document type is an assembly or part If (oDoc.DocumentType <> kAssemblyDocumentObject And _ oDoc.DocumentType <> kPartDocumentObject) Then strFiletype = "dwg" End If ' Get document's full file name sFname = oDoc.FullFileName ' The file format will depend on the extension ' Set file name extension to ".SAT" sFname = Left$(sFname, Len(sFname) - 3) & strFiletype ' Push the filename onto the Inventor clipboard Call ThisApplication.CommandManager.PostPrivateEvent(kFileNameEvent, sFname) ' Start the Save Copy As command. The file extension decides the file type Call ThisApplication.CommandManager.StartCommand(kFileSaveCopyAsCommand) End Sub