Hi
Here is a copy of my code, it does not do all open files, but it will export the current file.
I do however use a batch tool made by Curtis to export large data packs.
The only thing you need to change in the code is the destination directory, it will then be sufficient for testing and modifying.
'Date: 14.10.2020
'Author: Reg Hasell
'A basic check to see if the file already exists, (I did not want to slow the process down too much)
'The PDF file is created in the d:\data\Export directory.
'The current Revision is added to the filename.
Dim oDoc As Document
oDoc = ThisDoc.Document
Dim oPDFAddIn As TranslatorAddIn
oPDFAddIn = ThisApplication.ApplicationAddIns.ItemById("{0AC6FD96-2F4D-42CE-8BE0-8AEA580399E4}")
Dim oDocument As Document
oDocument = ThisDoc.Document
Dim oContext As TranslationContext
oContext = ThisApplication.TransientObjects.CreateTranslationContext
oContext.Type = kFileBrowseIOMechanism
' Create a NameValueMap object
Dim oOptions As NameValueMap
oOptions = ThisApplication.TransientObjects.CreateNameValueMap
Dim oDataMediumPDF As DataMedium
oDataMediumPDF = ThisApplication.TransientObjects.CreateDataMedium
'--PDF settings---
'If oPDFAddIn.HasSaveCopyAsOptions(oDataMedium, oContext, oOptions) Then
If oPDFAddIn.HasSaveCopyAsOptions(oDoc, oContext, oOptions) Then
oOptions.Value("All_Color_AS_Black") = 0
oOptions.Value("Remove_Line_Weights") = 0
oOptions.Value("Vector_Resolution") = 400
oOptions.Value("Sheet_Range") = Inventor.PrintRangeEnum.kPrintAllSheets
End If
'---End PDF settings
'---
oPath = ThisDoc.Path
oFileName = ThisDoc.FileName(False) 'without extension
oRevNum = iProperties.Value("Project", "Revision Number")
oDocument = ThisDoc.Document
oFolder = "d:\data\1 EXPORT"
oDataMediumPDF.FileName = oFolder + "\" + oFileName & "[" & oRevNum & "]" & ".pdf"
'MessageBox.Show(oDataMediumDWG.FileName, "Title")
If System.IO.File.Exists(oDataMediumPDF.FileName) Then
oChoice = MessageBox.Show(oDataMediumPDF.FileName & " Already Exists - Overwrite?", "Title", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If oChoice = 7
'MessageBox.Show("exit", "Title")
Return
Else
'MessageBox.Show("Overwrite", "Title")
End If
End If
'''--- Publish document.
oPDFAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMediumPDF)
Beep
MessageBox.Show("Done!", "Title")
Reg
2026.3