- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am currently trying to create a multi-purpose code that can work for multiple projects in the future. So heres the situation, I have bars that when extruded give me a length (Extruded Length = d51). I will then take the value of the extruded length and put it into a Excel file. The problem I am having is that I'd like to somehow skip/bypass lines of code that may not exist or be relevant in that current project without deleting large chunks of code out. Some of these projects may consist of 100 or so bars.
ExcelFile = "C:\Users\Desktop\INVENTOR_EXCEL\Parameter_Sheet"
If Parameter("(Part):1", "d51") > 0 Then
GoExcel.CellValue(ExcelFile, "Sheet1", "A1")= "(Part):1"
GoExcel.CellValue(ExcelFile, "Sheet1", "B1")= Parameter("(Part):1", "d51")
End If
If Parameter("(Part):2", "d51") > 0 Then
GoExcel.CellValue(ExcelFile, "Sheet1", "A2") = "(Part):2"
GoExcel.CellValue("B2") = Parameter("(Part):2", "d51")
End If
If Parameter("(Part):3", "d51") > 0 Then
GoExcel.CellValue(ExcelFile, "Sheet1", "A3") = "(Part):3"
GoExcel.CellValue("B3") = Parameter("(Part):3", "d51")
End If
.... (ect.)
EXAMPLE 1:
Problem: I have a project assembled with a "Part 1" and "Part 3"; but does not have a "Part 2"
With the current code that I have it notices that there is no "Part 2" and wants me to delete it in order for it to work.
EXAMPLE 2:
Problem: I have the same project as mentioned above, but now I replaced "Part 3" with "Part 2".
I had already deleted the code for "Part 2" and now it doesnt find a "Part 3". So I will have to go in and change everything manual each time.
The only solution I can come up with to solve this problem is to have it skip lines of the code if the part doesn't exsit. But I'm unsure on how to exactly do that. Which is why im reaching out to anyone that might be able to help.
Solved! Go to Solution.