Edit Existing Synthesis Resources/VBA

From ReliaWiki
Revision as of 21:56, 27 April 2016 by Kate Racaza (talk | contribs) (Created page with '{{Template:API}} ==Tutorial: Edit an Existing Synthesis Resource== Below is the VBA version of the tutorial. '''VBA''' Sub Main() …')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
APIWiki.png



Tutorial: Edit an Existing Synthesis Resource

Below is the VBA version of the tutorial.

VBA

Sub Main()

 'Connect to a Synthesis repository and project. 
  Dim MyRepository As New Repository
  MyRepository.ConnectToRepository("C:\RSRepository1.rsr10") 'Replace with name and path to test repository. 
  MyRepository.Project.SetCurrentProject(1) 'Replace with the object ID of test project. 

 'Declare a new cModel object. 
  Dim Amodel As New cModel
 
 'Retrieve a model from the repository. 
  Set AModel = MyRepository.Model.GetModel(21) 'Replace with the object ID of test model. 

  'Edit the model's name, description and part number. 
  Amodel.Name = "MyNewModel_Updated"
  Amodel.ItemDescription = "A specific type of light bulb."
  Amodel.ItemPartNumber = "PN5461"   
 
 'Send the changes to the Synthesis repository. 
  Call MyRepository.Model.UpdateModel(AModel)

End Sub