Community
Solved! Go to Solution.
Solved by danny. Go to Solution.
Hi, because on my desktop, this website still doesn't work, here again:
Hi all, why is this code returning a fault? Conversion from type DataMedium to Type String is invalid... But when used with pdf extension it works fine.
Dim oRevNum, oDwgName, oTekNr, oSubTitle, oNewFolder, oStatus, oPartNr As String '------start of iLogic------- oPath = ThisDoc.Path oFileName = ThisDoc.FileName(False) 'without extension oRevNum = iProperties.Value("Project", "Revision Number") 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 oTekNr = iProperties.Value("Custom", "Tekening Nummer") oNewFolder = iProperties.Value("Custom", "ExportMap") oStatus = iProperties.Value("Status", "Status") oSubTitle = iProperties.Value("Summary", "Title") oDwgName = iProperties.Value("Project", "Description") oPartNr = iProperties.Value("Project", "Part Number") If oPDFAddIn.HasSaveCopyAsOptions(oDataMedium, oContext, oOptions) Then oOptions.Value("All_Color_AS_Black") = 0 oOptions.Value("Remove_Line_Weights") = 1 oOptions.Value("Vector_Resolution") = 400 oOptions.Value("Sheet_Range") = Inventor.PrintRangeEnum.kPrintAllSheets 'oOptions.Value("Custom_Begin_Sheet") = 2 'oOptions.Value("Custom_End_Sheet") = 4 End If 'Check For the DXF folder And create it If it does Not exist If Not System.IO.Directory.Exists(oNewFolder) Then System.IO.Directory.CreateDirectory(oNewFolder) End If 'Set the DXF target file name oDataMedium.FileName = oNewFolder & "\" & oTekNr & "_" & oPartNr & "_" & oDwgname & oSubTitle & " Rev" & oRevNum & "_" & oStatus & ".dxf" If iProperties.Value("Custom", "DxfOnSave") = True Then ThisDoc.Document.SaveAs(oDatamedium , True) iProperties.Value("Custom", "DxfOnSave") = False 'Show in Explorer Shell("explorer.exe " & oNewFolder,vbNormalFocus) End If '------end of iLogic-------
I figured it out myself:
The code:
oDataMedium.FileName =
Needs to be:
oDataMedium =
For saveas DXF command; For saveas PDF, the code is oDataMedium.Filename.