EBDN - Community - Question & Answers

  Thursday, 23 September 2021
  5 Replies
  1.1K Visits
using SmartPDF (Version 4.1.44 from 16.04.2021) in EB 20201 (7.0.0) Build 388 in VBA-Makro does no longer store PDF as "Project".pdf , as it did in the past.
Now PDF-name is obviously the name of the Drawing.

I use this code to do the job.

Private Sub SaveAsPDF_TEST()
Dim oSheet As Sheet
Dim colAllSheets As ObjectItemCollection

Dim objProject As ObjectItem
Set objProject = ActiveProject

Set colAllSheets = New ObjectItemCollection

For Each oSheet In Application.Selection.Item(1).Children
If oSheet.Kind = aucObjSheet Then
colAllSheets.AddItem oSheet
End If

With Application.Automation
Call .Parameters.Clear
Call .Parameters.Add("M:\";) '0. Output path (String)
Call .Parameters.Add(objProject) '1. Project (ObjectItem)
Call .Parameters.Add(False) '2. With or Without Dialog (boolean)
Call .Parameters.Add(False) '3. bPagesOnly (export with device tree for page navigation only) (boolean)
Call .Parameters.Add(False) '4. ExportForRevision (boolean)
Call .Parameters.Add(False) '5. Mit oder ohne Advanced-Button (Erweiterung-Button) (boolean)
Call .Parameters.Add(colAllSheets) '6. Sheet-Collection (ObjectItem)
Call .Parameters.Add(False) '7. OpenOnEnd (boolean)
Call .Parameters.Add(False) '8. OnePdfPerDrawing (boolean)
Call .Parameters.Add(False) '9. TreeSheetDesignationWithComment (boolean)
Call .Parameters.Add(True) '10.ShowMatInToolTip (boolean)
' Call .Parameters.Add("";) '11.Name for Documents (string)
' Call .Parameters.Add("";) '12.Name for Equipment (string)
' Call .Parameters.Add("";) '13.Name for Functions (string)
' Call .Parameters.Add("";) '14.Name for CrossReferences (string)
' Call .Parameters.Add(True) '15.Equipment Navigation (boolean)
' Call .Parameters.Add(True) '16.Functions Navigation (boolean)
' Call .Parameters.Add(True) '17.CrossReferences Navigation (boolean)
' Call .Parameters.Add("";) '18.Add PDFs and Bookmarks (Array of strings - VBA:'arr())
' Call .Parameters.Add(True) '19.Color as black (boolean)

Call .Run("Export2PDF.bas2PDFMain.Run";)

End With
End Sub

Can anybody see a mistake?
Thanks for help.