Hello everyone!
I would like to automate furthermore the way our Part Number works.
Right now, we want to be able to add an embedded excel spreadsheet to our models and AUTOMATICALLY set that part's Part Number to the cell B1 in it... if there is no embedded excel spreadsheet, the Part Number should be it's filename (without extensions obviously).
Right now, I have a simple line of code that reads the first line of an embedded excel spreadsheet and sets its Part Number to the value...
I have 2 problems though with the following line...
1st problem is: How can I automatically find the 1st spreadsheet in the part and retrieve it's B1 cell? If I delete this embedded excel spreadsheet and insert another one, it will be Embedding 3 and won't be retrieved by the iLogic line that I have right now...
2nd problem: If there are no embedded excel spreadsheet, I still need to set automatically it's part number to filename w/o extension... I can't find a line to do this...
Heres the line of code that I have right now...
iProperties.Value("Project", "Part Number") = GoExcel.CellValue("3rd Party:Embedding 2", "Sheet1", "B1")
Try this out it should solve problem #2
Try iProperties.Value("Project", "Part Number") = "=" & GoExcel.CellValue("3rd Party:Embedding 2", "Sheet1", "B1") Catch End Try
I hope this helps.
Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.
I’m still trying to figure out the answer to your #1 problem.
Try / Catch will try to run the rule and if it fails then it will do nothing.
First of all there are a lot of better ways to write the code in this part but this should work. This might not be what you were asking for but it might make something’s easier.
In the User Parameters there is a (Embedded_Number) Parameter that’s a multi list drop down. If it reads “0” then the part name will be the same as your file name. Whenever you embed an Excel sheet you will have change the Parameter to match the sheet number.
I hope this helps in some way.
Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.