Hey all, fairly new to writing vba and I am trying to think of a way to apply a display rule when a saved view is applied. The display rule and saved view are named the same.
I was trying to write a user form with a combo-box to do this but I am only able to populate things like levels, cells (training docs) and active file name. Any ideas on how to get the combo box to populate all the saved views available in the active model? I guess after that would be to select one and then select a go button to active the saved view and the display rule based on the same name. I thought tweaking the existing training document would work but I just cant get past the population of the combo box. I cannot post the training data as it is Bentley copyright protected but I bet some of you already have this documentation.
Mark Winegar said:Any ideas on how to get the combo box to populate all the saved views available in the active model?
First, get a list of Saved Views. There's an example in VBA help that shows how to create a collection of Saved Views. Alternatively, you can use DesignFile.FindSaveView.
Next, populate your ComboBox with the Saved View information. ComboBox.AddItem does the trick.
Regards, Jon Summers LA Solutions
the scan is working and resolving the saved views but how do I call the collection in the combo box?
I figured out how to populate the combo box with all the saved views now. Now to execute a command to activate the saved view of what is selected.
Mark Winegar said: Now to execute a command to activate the saved view of what is selected
The ComboBox has many events that you can react to in your code. Double-click the ComboBox in your form and see what gets added to your UserForm's code.
With the UserForm code window open, click the menu in the top-left border of the code window. Choose your ComboBox, and then move your attention to the similar menu in the top-right border: that will show the events available for that widget. You probably want the _OnClick event. In that event, get the ComboBox text, which should be the selected Saved View name.