Discussion:
Customize Slide show menu
(too old to reply)
Steven
2006-09-19 08:14:49 UTC
Permalink
Dear,

I am trying to display a "Slide show" menu when the user click a buttom
after powerpoint slide show, code is below
'================
Set objBar = Application.CommandBars("Slide Show")
objBar.ShowPopup
'=================
but powerpoint prompts me "The Method 'ShowPopup' for the
object 'CommandBar' has failed."

at the time, I want to add a menu item in slide show menu, It promps me
"Invalid procedure", code is below, Anyone give me any ideas, Thanks

'========================
Set objBar = CommandBars("Slide Show")

For i = 1 To objBar.Controls.Count
If objBar.Controls.Item(i).Caption = "Do stuff" Then
bExist = True
End If
Next

If bExist = False Then
With objBar
Set oCtrl = .Controls.Add(Type:=msoBarBottom , Before:=3)
With oCtrl
.FaceId = 9
.Caption = "MyButtom"
.OnAction = "Hellofunction"
End With
End With

End If

objBar.ShowPopup
'========================
--
Best Regards
Steven
Cindy M.
2006-09-22 07:41:46 UTC
Permalink
Hi Steven,
Post by Steven
I am trying to display a "Slide show" menu when the user click a buttom
after powerpoint slide show
Since you've not gotten any response in any of these groups, try asking
in the (one-and-only) Powerpoint newsgroup. They handle both end-user and
Dev questions there.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :-)
Nick Hebb
2006-09-22 09:17:05 UTC
Permalink
Hi Steven,

I haven't programmed PowerPoint, but when glancing at this several
things stood out.

1. Since a local variable is usually created for the Application
object, it seems strange that you use the Application object when you
reference CommandBars. I would expect something like:
Set objBar = objApp.CommandBars("Slide Show")

Could the use of "Application" be your problem?

2. The Position property of a CommandBar needs to be set to floating
(msoBarFloating) before you call the ShowPopup method: objBar.Position
= msoBarFloating

3. Slide Show is a top-level, built-in menu, not a toolbar. Are you
sure you can float and popup top-level, built-in menus? I'm not saying
you can't but it would never occur to me to try.

4. When you add the control, you have the wrong Type (should be
msoBarButton), need to set thr ID to 1 for non-built-in command
controls, and should include the parameter Temporary:=True. The
following is a possible solution:

Set oCtrl = objBar.Controls.Add(msoControlButton, 1, "MyButton", 3,
True)
With oCtrl
.Style = msoButtonIconAndCaption
.Caption = "MyButton"
.FaceId = 9
.OnAction = "Hellofunction"
.Enabled = True
End With
Nick Hebb
2006-09-22 09:24:02 UTC
Permalink
Oh, and I forgot to ask whether you're sure this is a COM add-in (which
is what this Google Group is for) and not a regular add-in?

If it's a COM add-in then the .OnAction parameter needs to be setup
differently.

-- Nick Hebb
http://www.breezetree.com

Continue reading on narkive:
Loading...