Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

Thanks, that works now but I don't understand why it works. Please can you have a look? I have commented out what I think is happening in each stage.

 

I also don't really understand what the command DIM does. 

 

It's great getting help on the internet but if I don't understand it I will never learn to do it myself. 

 

Thank you!

 

'location of temporary folder
TempFile="***\temp_part.ipt"
'Location of target folder
TargetFile="***\New file.ipt"

'Save a temporary file
ThisDoc.Document.SaveAs(TempFile, True)

'Declares Temp2 as a PartDocument variable?
Dim Temp2 As PartDocument 
'Switches ilogic focus to the open temp file?
Temp2 = ThisApplication.Documents.Open(TempFile, True)

'Definies the temp part's parameters as a variable?
Dim oDef As PartComponentDefinition
'Switches iLogic focus to the temp parameters instead of where rule is running?
oDef = Temp2.ComponentDefinition 
'Sets the temp part parameter from input box
oDef.Parameters.Item("w").Expression = InputBox("Width", "Size", "10") 
 
'forces a rebuild?
Call Temp2.Update 
'Saves temp file as new file in target location
Temp2.SaveAs(TargetFile, True)
'Close Temp file
Temp2.Close