I'm wondering if it's possible to pull text/data from other documents and into Drawing Templates.
Example:
I have a drawing for a pipe and i want to pull data from a WPS (Welding procedure Specification). Lets say this document gets created by a different person but always in the same path as the output drawing. is it possible to create a dedicated field in the WPS, which again can be pulled into the dwg?
I would like it to show as source in "Format text" dialog.
i have no clue on where to begin on this and i would appreciate any inputs 🙂
Solved! Go to Solution.
Solved by tyler.warner. Go to Solution.
Solved by tyler.warner. Go to Solution.
Update.
I'm able to extract information to a custom Iproperty and then use it on the sheet. the text does not display for some reason. and im not sure how i will make the path change for different documents.
GoExcel.Open("C:\Users\Patrick\OneDrive - Rørtek As\Desktop\TEST-WPS.xlsx", "Ark1") iProperties.Value("User Defined Properties", "Standard") = GoExcel.CellValue("A3") iLogicVb.UpdateWhenDone = True
The iproperties does get information from excel sheet here.
but this plot does not work.
this works now. but i need to be able to change Reference excel document.
Would it work for you to just add another custom iProperty that specifies the source?
For both of these examples, you would just create that additional custom iProperty called "StandardSource".
This example you would change the property to be the title of the source file.
StandardSource = TEST-WPS.xlsx
GoExcel.Open("C:\Users\Patrick\OneDrive - Rørtek As\Desktop\" & iProperties.Value("User Defined Properties", "StandardSource"), "Ark1")
iProperties.Value("User Defined Properties", "Standard") = GoExcel.CellValue("A3")
iLogicVb.UpdateWhenDone = True
This example you would change the property to be the full path & title of the source file.
StandardSource = C:\Users\Patrick\OneDrive - Rørtek As\Desktop\TEST-WPS.xlsx
GoExcel.Open(iProperties.Value("User Defined Properties", "StandardSource"), "Sheet1")
iProperties.Value("User Defined Properties", "Standard") = GoExcel.CellValue("A3")
iLogicVb.UpdateWhenDone = True
Thanks
This is better than what i had. But i want it for look for documents in the same folder as drawings. so that as long as there is a WPS-XXX.xlsx file in that folder it will use the one that is available. i dont know what will happen if there ar two different files though.
to be honest, im just experimenting and trying to find ways for improvement. if you have any other ilogic/VB tips for drafts i would much appreciate.
Thanks in advance 🙂
If you supply the filename and extension then go excel will search the directory of the document you launched the rule from.
GoExcel.Open("TEST-WPS.xlsx")
Or alternatively use ilogic function ThisDoc.Path and filename.
GoExcel.Open(ThisDoc.Path & "\TEST-WPS.xlsx)
You can try something like this that will search the folder of the current document for a file that has "WPS" & ".xlsx" & then opens that one.
Dim oPath As String = ThisDoc.Path & "\"
Dim oFiles As String() = System.IO.Directory.GetFiles(oPath)
For Each oFile In oFiles
If oFile.Contains("WPS") And oFile.Contains(".xlsx")
GoExcel.Open(oFile, "Ark1")
iProperties.Value("User Defined Properties", "Standard") = GoExcel.CellValue("A3")
iLogicVb.UpdateWhenDone = True
Exit For
End If
Next
This is close to what i want. i am just experimenting as previously stated. but i will get a problem with multiple files named WPS.xlsx, right?
Thanks alot for your help 🙂
It will just go with the first file that it finds which fits the search criteria. You can add a prompt or something if you want to do a check.
You could do something like this with a basic message box if you want user interaction.
Dim oPath As String = ThisDoc.Path & "\"
Dim oFiles As String() = System.IO.Directory.GetFiles(oPath)
For Each oFile In oFiles
If oFile.Contains("WPS") And oFile.Contains(".xlsx")
Dim oResult = MessageBox.Show("Is this the correct file?" & vbNewLine & oFile, "File Selection", MessageBoxButtons.YesNo)
If oResult = DialogResult.Yes
GoExcel.Open(oFile, "Ark1")
iProperties.Value("User Defined Properties", "Standard") = GoExcel.CellValue("A3")
iLogicVb.UpdateWhenDone = True
Exit For
End If
End If
Next
Good job, i can see there are many possibilities to achieve my goal.
thanks alot, i'll try to be more active on ilogic/vba as this is a very interesting subject.
Can't find what you're looking for? Ask the community or share your knowledge.