Guten Tag die Damen und Herren, (gibts eigentlich auch Damen im VBA-Forum?)
ich bin gerade dabei unsere AutoPLOT-Funktionen für IV 2009 aufzufrischen und möchte das PDF-plotten (mit FreePDF) gegen das jetzt vorhandene SAVE AS PDF austauschen.
Jetzt stellt sich die Frage: Wie kann ich die Optionen, die es in der Dialogbox bei SAVE_AS gibt per VBA einstellen?
Ich habe die Inventor-Hilfe bemüht, und komme auch auf Beispiele fürs SAVE_AS (Begriff: "TranslatorAddIn Object"), hier fehlt mir dann aber die "ApplicationAddIns.ItemById" für PDF.
Auf diese bin ich dann im AutodeskIV_VBA Forum gestoßen, aber bei dem hier angegebenen Code bekomme ich immer eine Fehlermeldung.
Hat jemand eine Idee?
Gruß
Peter
Hier der Code aus dem Autodesk IV-VBA-Forum, der bei mir nicht läuft:
Public Sub PublishPDF()
' Get the PDF translator Add-In.
Dim PDFAddIn As TranslatorAddIn
Set PDFAddIn = ThisApplication.ApplicationAddIns.ItemById("{0AC6FD96-2F4D-42CE-8BE0-8AEA58 0399E4}")
'Set a reference to the active document (the document to be published).
Dim oDocument As Document
Set oDocument = ThisApplication.ActiveDocument
Dim oContext As TranslationContext
Set oContext = ThisApplication.TransientObjects.CreateTranslationContext
oContext.Type = kFileBrowseIOMechanism
' Create a NameValueMap object
Dim oOptions As NameValueMap
Set oOptions = ThisApplication.TransientObjects.CreateNameValueMap
' Create a DataMedium object
Dim oDataMedium As DataMedium
Set oDataMedium = ThisApplication.TransientObjects.CreateDataMedium
' Check whether the translator has 'SaveCopyAs' options
If PDFAddIn.HasSaveCopyAsOptions(oDocument, oContext, oOptions) Then
' Options for drawings...
oOptions.Value("All_Color_AS_Black") = 0
'oOptions.Value("Remove_Line_Weights") = 1
'oOptions.Value("Vector_Resolution") = 1
'oOptions.Value("Sheet_Range") = kPrintAllSheets
'oOptions.Value("Custom_Begin_Sheet") = 2
'oOptions.Value("Custom_End_Sheet") = 4
'End If
'Set the destination file name
oDataMedium.FileName = "c:\temp\test.pdf"
'Publish document.
Call PDFAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium)
End Sub
[Diese Nachricht wurde von pd65 am 30. Mai. 2008 editiert.]
Eine Antwort auf diesen Beitrag verfassen (mit Zitat/Zitat des Beitrags) IP