4

I'm just getting into using Rubberduck for my VBA applications. I came across a great post on adding attributes here: How to set the Attribute VB_PredeclaredId using RubberDuck '@PredeclaredID

However, what if I want to remove the attribute? It seems like the only way to do it is via code inspections. However, after you initially set the '@PredeclaredId, there's no longer any error that shows up. So the option to remove the attribute is no longer available.

I tried deleting the attribute, but the "Predeclared" annotation is still in my explorer: enter image description here

I'm sure I can export, edit in the text editor, and then re-import again, but one purpose of rubberduck is to avoid doing that.

Thanks.

1 Answers1

1

After deleting the attribute annotation there will be a new "attribute value out of sync" inspection with 2 options:

  • adjust attribute value
  • adjust annotation

You want to do the first option which will nuke the hidden attribute value.

Update

enter image description here


Another 2 alternatives:

  • indent the module ctrl+m
  • cut and paste the code ctrl-a ctrl-x ctrl-v

Both these options will wipe out the attribute values by forcing VBA to recompile the module without them. This is normally an annoyance (indenting my project wipes the attributes and I need to restore them with RD annotation inspections)

Final thing remember to refresh RD code explorer so it picks up the changes and the icon will change. This often happens automatically though.

Greedo
  • 4,967
  • 2
  • 30
  • 78
  • The first option does not happen. I do not get a new "attribute value out of sync". This is what I was expecting to happen but it didn't. I'll give the other two options a try and see what happens. Thanks. – Anthony Meeks Nov 23 '22 at 16:07
  • @AnthonyMeeks See update, you have to refresh. There is a Missing module annotation inspection – Greedo Nov 24 '22 at 12:58