Dear VBA gurus,
I am trying to get a method to rename an existing tagset in the dgn file. I learnt about "add new" but it would be nice if I could simply rename a tagset instead. Since that tagset is assigned to some elements aready, removing it and attaching a new tagset to new elements is not an option for me.
Thank you so much,
Sincerely,
Rabi
Dear Rabi
Private Sub RenameTagset() Dim oTagSet As TagSet On Error Resume Next Set oTagSet = ActiveDesignFile.TagSets("EXISTING_TAG_SET_NAME") If Not (oTagSet Is Nothing) Then
oTagSet.Name = "NEW_TAG_SET_NAME" End If End Sub
The tags can be renamed too if you need similar maner look a tthe tagset/tag defintiions in the help not the use of them with elements.
Best Regards,
Ian: The tags can be renamed too ...
The tags can be renamed too ...
Any existing tag elements in the DGN file must have the tag set renamed, otherwise you will have orphan tag elements.
Regards, Jon Summers LA Solutions
Can someone clarify how this VBA code is used? Does this go in a class module and if so what do you put in a normal module?
There's nothing special about that code. It should run contentedly in a normal module, or for that matter in a form or class module.
Hi Jon
I've tried running vba run [RenameTags]Module1.RenameTagset but get the error VBA interface error: unable to run macro - invalid procedure name. My file is called RenameTags.mvba, the code is in a normal module called Module1 and the code is as above with the exception of the tagset names changed. Is it obvious where I've gone wrong?
Hi,
If you attached a copy of your mvba, or gave us more detailed information, then someone could help. Also, it may be good to include the Microstation version number that you're working in.
--Robert
Hi Robert, I'm using version 08.11.07.443
I don't think there's any more info I can provide other than what I've already posted. The code I'm using is from the second post of this page and I've explained above where I've put the code and what I changed (though the changes aren't the issue as the code won't run at this time)
thanks
You're doing a key-in to start the routine. The routine is "Private sub ..." which means that it's only available from within that module. Remove the "Private" from the Sub statement to make the routine accessible from Microstation directly.
I3looM said: I'm using version 08.11.07.443
That's MicroStation V8i.
Although in this case I don't think it makes any difference, in general you should post to the VBA Forum for your version of MicroStation. Sometimes there are quite significant differences in the various APIs from version to version.