commandbars and reference library problem

G

Guest

Hi

I am trying to remove the ms office reference library, but have used the
following throughout my application, which requires this reference library:

Application.CommandBars("contactsmenubar").Controls("&Actions").Controls("&Suspended Account").State = msoButtonUp

The problem being msoButtonUp (or msoButtonDown). I have located the
following from an old thread, but am not quite sure how to apply:

"for the declarations you'd change them to object or variant. For the
enums, find the actual value by opening the immediate window and typing
?msoBarTop while you still have a reference....then create your own constant
for that enum, or replace it with the actual value. After you've made the
changes, you should be able to remove the reference and compile."

i have followed this advice and come up with following:

Dim Cbr As Object
Dim Ctl As Object
Set Cbr = Application.CommandBars("contactsmenubar")
Set Ctl = cbr.Controls("&Actions").Controls("&Suspended Account").State = -1

where -1 was the value from ?msoButtonUp in the immediate window, but once
the reference is removed i get an "object required" error.

Any thoughts would be much appreciated.

Thanks
 
G

Guest

:~)

"Set Ctl=obj=1"

of course what you meant to say was:

Set Ctl = cbr.Controls("&Actions").Controls("&Suspended Account").State

Ctl= -1

(david)



Hi

I am trying to remove the ms office reference library, but have used the
following throughout my application, which requires this reference library:
Application.CommandBars("contactsmenubar").Controls("&Actions").Controls("&S
uspended Account").State = msoButtonUp
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top