Edit Existing Synthesis Resources/VBA: Difference between revisions
Jump to navigation
Jump to search
Kate Racaza (talk | contribs) No edit summary |
Kate Racaza (talk | contribs) No edit summary |
||
Line 10: | Line 10: | ||
{{APIComment|'Connect to a Synthesis repository and project.}} | {{APIComment|'Connect to a Synthesis repository and project.}} | ||
{{APIPrefix|Dim}} MyRepository {{APIPrefix|As New}} Repository | {{APIPrefix|Dim}} MyRepository {{APIPrefix|As New}} Repository | ||
MyRepository.ConnectToRepository({{APIString|"C:\RSRepository1. | MyRepository.ConnectToRepository({{APIString|"C:\RSRepository1.rsr11"}}){{APIComment|'Replace with name and path to test repository.}} | ||
MyRepository.Project.SetCurrentProject(1){{APIComment|'Replace with the object ID of test project.}} | MyRepository.Project.SetCurrentProject(1){{APIComment|'Replace with the object ID of test project.}} | ||
Latest revision as of 18:16, 3 April 2017
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.rsr11") '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 project. 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 project. Call MyRepository.Model.UpdateModel(AModel) End Sub