For the life of me I cant find anything or figure out how to edit a tag's value using VBA.
It seems like it would be easy enough but its got me stumped! Can this be done with VBA?
Hi Jonathan,
you do not specify what MicroStation version do you use (please read and follow MicroStation Programming Forum best practices).
For V8i and CONNECT Edition I recommend to start with Adding and Modifying Tag Elements examples that are part of MicroStation VBA help.
With regards,
Jan
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
Sorry Jan, I'm using V8i SS3.
translate.google.it/
4034.update_tag.zipHello Jonathan I enclose a small example of tag editing. Cell with associated tag is updated with the coordinates of the cell originCiao
Thank you Blumax57 I will check it out!
Jonathan said
"Thank you @Blumax57. When I import the MVBA into my project, the code appears to be compiled and the macro name doesn't appear."
my code is not protected
can anyone try?
Ciao
I got it to work. Thanks
Jonathan N said:I cant find anything or figure out how to edit a tag's value using VBA
This article about Reading and Writing Tag Data with VBA may help.
Regards, Jon Summers LA Solutions
I got bluemax57's code to work, but I have to select a tag first.
Is it possible to have VBA change the tag value without having to select anything?
Jonathan N said:Is it possible to have VBA change [an element] without having to select anything?
There are several ways that a user can instruct a macro about the object of her desires...
Write a VBA class that Implements ILocateCommandEvents. There are examples in VBA help.
Implements ILocateCommandEvents
ModelReference.GetSelectedElements returns an ElementEnumerator
ModelReference.GetSelectedElements
ElementEnumerator
Fence.GetContents returns an ElementEnumerator
Fence.GetContents
MicroStation's scanner lets you examine every element in a DGN model. See ModelReference.Scan. You can filter the elements using various criteria.
ModelReference.Scan
Jonathan N said:Is it possible to have VBA change the tag value without having to select anything?
Yes. A standard way is to use ElementScanCriteria to define what type of element want to search and to scan model reference (ActiveModelReference in this case) using the criteria.
See ElementScanCriteria and Scan methods documentation in VBA help, there are several examples available how to use them to find a specific elements in a model.
Regards,