BleepingComputer.com: VBA Extensibility Problem

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

VBA Extensibility Problem Sometimes it just doesn't work

#1 User is offline   shawnvw 

  • Member
  • PipPip
  • Find Topics
  • Group: Members
  • Posts: 113
  • Joined: 20-May 05

Posted 18 January 2010 - 08:42 PM

I hope someone is familiar with the VBA Extensibility reference. That's the thing that lets you write code that modifies forms, modules, and projects at design time. It's very useful and notoriously badly documented.

I have some procedures that literally work one day and don't work the next. I can't figure out why. As an example:

For each aVbc in MyDoc.VBProject.VBcomponents
If left(aVbc.name, 8) = "UserForm", then
ActiveDocument.VBProject.VBComponents.Remove(aVbc) ' <=== FAIL Object does not support this property or method.
' I also tried this instead:
aVbc.Remove ' <=== FAIL: Object does not support this property or method.
end if
next aVbc

It used to work, honest. What could I have done that changed it?

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users