ActionControl returning object not set message

S

Suzy

Hello

I am making progress today, and decided to run the menu generator code
referred to in my previous post from Word, and with a few alterations,
now works fine.

But. When I run the Action code - CatItemSelect, I can't seem to get
the Tag reference.

I use this code in Word:
Dim strDir as String
strDir = CommandBars.ActionControl.Tag

and after reading Shyam's posts in this (fantastic) group I changed to
the following in powerpoint:

but neither works and both return a "Object Variable not set" error on
the line "strDir=..."

Dim cmdBCtl as CommandBarControl
Dim strDir as String
Set cmdBCtl = Application.CommandBars.ActionControl
strDir = cmdBCtl.Tag

or
strDir = Application.CommandBars.ActionControl.Tag

I thought maybe this was due to my building the menu via Word, but if
I loop through the controls of the menu without the ActionControl, I
can see that the Tags are there, I just can't seem to find out which
one refers to the one that has been selected.

any suggestions are welcome!
Thanks in advance
regards
Suzy
 
C

Chirag

ActionControl property would get set only when the procedure is running
through command bar control. If the procedure is not running through a
command bar control, then ActionControl is set to Nothing. So, if you are
trying to run the subroutine in VBA Editor, then you would get "Object
Variable not set" kind of error.

- Chirag

PowerShow - View multiple PowerPoint slide shows simultaneously
http://officeone.mvps.org/powershow/powershow.html
 
S

Suzy

Chirag

Thanks (yes, I now see that it does work when selected from the menu),
you saved me a nervous breakdown! That's what I get for trying to
work something out on a Sunday in 30 degree heat.

While embarrassed, I am so relieved it was simple thing!

kind regards
Suzt
 
Top