Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello, I need some help with the code below.
My goal is to have the user enter a number into the message box and that will set the range of sheets to be printed to a pdf.
When I remove the myparam from this line of code oOptions1.Value("Custom_End_Sheet") = myparam and enter a number (for example oOptions1.Value("Custom_End_Sheet") = 5) the code works, I can't figure out how to get the number from the input box to the end sheet.
myparam = InputBox("", "END SHEET", "3") Custom_End_Sheet = myparam iProperties.Value("Custom", "ISSUED_BY")=ThisApplication.GeneralOptions.UserName iProperties.Value("Custom", "ISSUE_DATE")=Now InventorVb.DocumentUpdate() ' Get the PDF translator Add-In. Dim PDFAddIn As TranslatorAddIn PDFAddIn = ThisApplication.ApplicationAddIns.ItemById("{0AC6FD96-2F4D-42CE-8BE0-8AEA580399E4}") 'Set a reference to the active document (the document to be published). Dim oDocument1 As Document oDocument1 = ThisApplication.ActiveDocument Dim oContext1 As TranslationContext oContext1 = ThisApplication.TransientObjects.CreateTranslationContext oContext1.Type = kFileBrowseIOMechanism ' Create a NameValueMap object Dim oOptions1 As NameValueMap oOptions1 = ThisApplication.TransientObjects.CreateNameValueMap ' Create a DataMedium object Dim oDataMedium1 As DataMedium oDataMedium1 = ThisApplication.TransientObjects.CreateDataMedium 'Check whether the translator has 'SaveCopyAs' options If PDFAddIn.HasSaveCopyAsOptions(oDocument1, oContext1, oOptions1) Then ' Options for drawings... oOptions1.Value("All_Color_AS_Black") = 1 'oOptions1.Value("Remove_Line_Weights") = 0 oOptions1.Value("Vector_Resolution") = 4800 oOptions1.Value("Sheet_Range") = Inventor.PrintRangeEnum.kPrintSheetRange oOptions1.Value("Custom_Begin_Sheet") = 1 'MessageBox.Show(Custom_End_Sheet, "END SHEET") oOptions1.Value("Custom_End_Sheet") = myparam' this line is the line in question End If oPath1 = ThisDoc.Path oDataMedium1.FileName = oPath1 & "\Transmittal\" & ThisDoc.FileName(False) & " (" & DateString & ")" & ".pdf" Call PDFAddIn.SaveCopyAs(oDocument1, oContext1, oOptions1, oDataMedium1)
Solved! Go to Solution.