Run a task that will automatically save as a part multiple times with new names

Run a task that will automatically save as a part multiple times with new names

acanx21
Enthusiast Enthusiast
351 Views
1 Reply
Message 1 of 2

Run a task that will automatically save as a part multiple times with new names

acanx21
Enthusiast
Enthusiast

I created some parts that are linked to an excel sheet. That excel sheet has a name for the part and all the dimensions and parameters associated with that part name. 

 

As of right now, I am able to save as the part manually with a new name that's on the excel sheet and everything updates.

 

I want to be able to run something that will save as the part with new names that I can feed it with a list or something so that I don't have to sit there saving as and typing the new name for every single part. 

 

Does anyone have any idea if this would be possible?

0 Likes
352 Views
1 Reply
Reply (1)
Message 2 of 2

CadUser46
Collaborator
Collaborator

Firstly you will need to load the Excel file.  If you search the forum there should be a Brian Erkins post of how to start and stop Excel.

 

You will need to process the list similar to this

 

Dim outPath as string: outPath = "\somepath\"
Dim outFullPath as string
Dim i as integer: i=1
Dim fso As New FileSystemObject


'Open the base model

'Save as the new file and iterate down the list of spreadsheet cells
Do while cell.value <> ""
       outFullPath = outPath + workbook.sheets(1).cells(i,1).value
       If fso.FileExists(outFullPath) = False Then oPNDoc.SaveAs outFullPath, True
 
      i=i+1

next

Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.

---------------------------------------------------------------------------------------------------------------------------
Inventor 2010 Certified Professional
Currently using 2023 Pro