views:

161

answers:

1

Hello,

I have some code that I execute when a slide show presentation begins but because it takes some time, I want to create a button in a Powerpoint toolbar to execute this code.

So, I click on the button and after that I want to happear a progress bar!

How can I use vba to create a new button in a Powerpoint toolbar and how can I make a progress bar when I click on it?

Oh, at the end of the progress bar I want to execute the slide show. How can I do that as well?

Thanks in advance!

+1  A: 

1.

How can I use vba to create a new button in a Powerpoint toolbar

Try this code:

Sub AddButton()
   Dim cb As CommandBar

   Set cb = Application.CommandBars.Add("additional_toolbar", msoBarTop, , True)

   With cb.Controls.Add(msoControlButton)
      .Caption = "click me"
      .OnAction = "macro_name"
      .Style = msoButtonCaption
   End With
   cb.Visible = True
End Sub

2.

how can I make a progress bar when I click on it?

I would suggest creating UserForm with ProgressBar control on it.

3.

try this to begin slide show [source]:

Sub BeginSlideShow()
    ActivePresentation.SlideShowSettings.Run
End Sub

Additionally:
there is no equivalent of PERSONAL (from Excel) in PowerPoint , only place for storing code is presentation itself, so you need open presentation before executing any code.

Cornelius
thanks m8. one last question, how can I put an icon on the button?
aF
Cornelius