Message 1 of 5
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I'm using some standard code to save copy certain sheets to a PDF.
But this only seems to work if I put the options on Sheet in range manually
Is it possible te check if the PDF options are set on Sheets in range or do so via ilogic?
Thank in advance!
SyntaxEditor Code Snippet
' Get the PDF translator Add-In. oPDFAddIn = ThisApplication.ApplicationAddIns.ItemById _ ("{0AC6FD96-2F4D-42CE-8BE0-8AEA580399E4}") oDocument = ThisApplication.ActiveDocument oContext = ThisApplication.TransientObjects.CreateTranslationContext oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism oOptions = ThisApplication.TransientObjects.CreateNameValueMap oDataMedium = ThisApplication.TransientObjects.CreateDataMedium ' Get the sheet range SheetRange = InputBox("Please enter the range of sheets you want to export as FIO" & vbLf & _ "You can use these input types:" & vbLf & " ' 1 ' , ' 1-10 ' ", "Sheet range", "Enter sheet range") If SheetRange = vbNullString Then Exit Sub Dim SPL As Integer = InStr(SheetRange, "-") Dim S1 As Integer Dim S2 As Integer If SPL > 0 Then S1 = Val(Left(SheetRange, SPL)) S2 = Val(Mid(SheetRange, SPL + 1)) Else S1 = Val(SheetRange) S2 = Val(SheetRange) End If ' Options for drawings... oOptions.Value("All_Color_AS_Black") = 0 oOptions.Value("Remove_Line_Weights") = 0 oOptions.Value("Vector_Resolution") = 4800 'oOptions.Value("Sheet_Range") = kPrintAllSheets oOptions.Value("Custom_Begin_Sheet") = S1 oOptions.Value("Custom_End_Sheet") = S2 'Set the destination file name modelFullFileName = ThisDrawing.ModelDocument.FullFileName modelDirectoryName = IO.Path.GetDirectoryName(modelFullFileName) modelFileName = IO.Path.GetFileNameWithoutExtension(modelFullFileName) oDataMedium.FileName = modelDirectoryName & "\" & "FIO " & modelFileName & ".pdf" 'Publish document. oPDFAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium)
Solved! Go to Solution.