Message 1 of 12
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am having trouble updating an ilogic rule that saved IDW files to PDF it worked fine in 2016 but is throwing error messages in 2018.
I have followed the forum answers for fixing the 1 first error but now get a new error.
" unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL)"
The code creates a PDF but it is unreadable by adobe PDF reader??
I have pasted my code below:
SyntaxEditor Code Snippet
'------start of iLogic------- oPath = ThisDoc.Path oFileName = ThisDoc.FileName(False) 'without extension 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 'Define the drawing Dim oDrawing As DrawingDocument oDrawing = ThisDoc.Document Dim oSheet As Sheet Dim lPos As Long Dim rPos As Long Dim sLen As Long Dim sSheetName As String Dim iSheetNumber As Integer oSetFileName = InputRadioBox("Set the file names as created??", "Yes", "No", True, Title := "SET FILE NAMES") oRevNo = InputBox("REV-NO."& vbCrLf & _ "IF NONE REQUIRED DELETE ? ", "Set REV NO", "?") oFolder = oPath & "\PDF" MessageBox.Show("FILES WILL BE SAVED IN. " & vbCrLf & vbCrLf & oFolder, "Files saved in.") 'step through each drawing sheet For Each oSheet In oDrawing.Sheets 'find the seperator in the sheet name:number lPos = InStr(oSheet.Name, ":") 'find the number of characters in the sheet name sLen = Len(oSheet.Name) 'find the sheet name sSheetName = Left(oSheet.Name, lPos -1) 'find the sheet number iSheetNumber = Right(oSheet.Name, sLen -lPos) 'set PDF Options oOptions.Value("All_Color_AS_Black") = 0 oOptions.Value("Remove_Line_Weights") = 1 oOptions.Value("Vector_Resolution") = 400 oOptions.Value("Sheet_Range") = Inventor.PrintRangeEnum.kPrintSheetRange oOptions.Value("Custom_Begin_Sheet") = iPageNumber oOptions.Value("Custom_End_Sheet") = iPageNumber 'get PDF target folder path oFolder = oPath & "\PDF" 'MessageBox.Show(oFolder, "Title") 'Check for the PDF folder and create it if it does not exist If Not System.IO.Directory.Exists(oFolder) Then System.IO.Directory.CreateDirectory(oFolder) End If If oSetFileName = True Then oFilename = InputBox("Is this the file name you want??", "Title", sSheetName & "-" & oRevNo ) ElseIf oSetFileName = False Then oFilename = sSheetName & iSheetNumber & "-" & oRevNo End If 'Set the PDF target file name oDataMedium.FileName = oFolder & "\" & oFilename & ".pdf" 'Publish document oPDFAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium) FilePath = oFolder 'MessageBox.Show(oFilename, "Title") Next '------end of iLogic-------
Any help would be greatly appreciated....
Solved! Go to Solution.