- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have not fund an code that work jet .. but I have fund some of the problem with the code
first of all
GoExcel.CellValue(excel_file, "Sheet1", "A" & i) = iProperties.Value("Project", "Part Number")
it does not read the properties on the that you are open .. with the ilogic code .. but the properties on the file that you open to run the file ... but the code do run on my computer and work it does just not read the properties form the right fil.
second thing
the code fail if excel are not close ... you might have to close all the excel in the joblist
3rd.
It look like it also fail if the cell are not emtry when you start the code.... I am not 100 % sure of this because it might just have been an Excel program that i have not fund and close..
I use this code to do what your want .. just to open all drawing form an assambly ... maybe you can find a way to rewrite this .. I do not know how at det time and I have to go to bed now... I might look at it again later if i get the time
oRefDocs = oAsmDoc.AllReferencedDocuments 'Dim oRefDoc As Document cell = 2 For Each oRefDoc In oRefDocs cell = cell+1 idwPathName = Left(oRefDoc.FullDocumentName, Len(oRefDoc.FullDocumentName) -3) & "idw" debug(idwPathName.ToString & " " & "NewDrawning") 'GoExcel.Open(ExcelPath, ExcelSheet) 'GoExcel.CellValue(ExcelPath, ExcelSheet, "B" + Cell.ToString) = idwPathName ' Check to see that the model has a drawing of the same path and name Dim oDrawDoc As DrawingDocument 'False Grafik off True Grafik on 'MessageBox.Show(idwPathName, "Title") Try oDrawDoc = ThisApplication.Documents.Open(idwPathName, False) Catch ExcelPath = "C:\Working Folder\CAD\Kallesoe\Kallesoe iLogic\PDFLOg.xlsx" ExcelSheet = "Log" GoExcel.Open(ExcelPath, ExcelSheet) GoExcel.CellValue(ExcelPath, ExcelSheet, "B" + cell.ToString) = Left(oRefDoc.FullDocumentName, Len(oRefDoc.FullDocumentName)) 'GoExcel.CellValue(ExcelPath, ExcelSheet, "B" + cell.ToString) = idwPathName Try GoExcel.CellValue(ExcelPath, ExcelSheet, "C" + cell.ToString) = iProperties.Value(oRefDoc.DisplayName, "Project", "Description") GoExcel.CellValue(ExcelPath, ExcelSheet, "D" + cell.ToString) = iProperties.Value(oRefDoc.DisplayName, "Custom", "Part Description") Catch oRefDoc.DisplayName="" GoExcel.CellValue(ExcelPath, ExcelSheet, "C" + cell.ToString) = iProperties.Value(oRefDoc.DisplayName, "Project", "Description") Try GoExcel.CellValue(ExcelPath, ExcelSheet, "D" + cell.ToString) = iProperties.Value(oRefDoc.DisplayName, "Custom", "Part Description") Catch end try debug("wrong displaynName " & idwPathName.ToString) End Try GoExcel.Save 'GoExcel.Close End Try If (System.IO.File.Exists(idwPathName)) Then ThisApplication.Documents.Open(idwPathName, True) Dim auto = iLogicVb.Automation auto.RunExternalRule(oDrawDoc, "SavePDF") oDrawDoc.Close oDrawDoc.Close ExcelPath = "C:\Working Folder\CAD\Kallesoe\Kallesoe iLogic\PDFLOg.xlsx" ExcelSheet = "Log" GoExcel.Open(ExcelPath, ExcelSheet) GoExcel.CellValue(ExcelPath, ExcelSheet, "B" + Cell.ToString) = idwPathName GoExcel.Save GoExcel.Close