Running a Macro from a toolbar using onAction

G

Gordon Muir

As far as I can tell, the onAction property has intentionally been disabled
in Project 2007. Although it is possible to add buttons to a toolbar and
assign a macro using the GUI, I cannot find a way to do this from VBA for a
combo box (I have managed to figure it out for a button). The following code
used to work in 2003:

With customBar
Dim r As Resource

.Controls.Add Type:=msoControlComboBox, Before:=1

With .Controls(1)
For Each r In ActiveProject.Resources()
.AddItem r.Name
Next r

.BeginGroup = False
.Caption = "Show Resource"
.TooltipText = "Show tasks using Resource with Resource
Calendar"
.OnAction = "ShowResourceAction"
End With

.... but now, it does not work. Since there is a way to do this using the
"ID" and "Parameter" properties for buttons and other built-in components,
I'm hoping there is a way to make this work in 2007. On the other hand, I
guess this functionality has been disabled for a reason...

Anyone any ideas?

Thanks,

Gordon
 
M

med111

Hi Gordon
try to use this syntax for 2007.

..OnAction = "Macro ""ShowResourceAction"""

I think it will work.
 

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