VBA Macros

J

John

Hello,

I'm having difficulty opening a form I created in powerpoint. I have the
following:

Const Path = "C:\Documents and Settings\SS\My Documents\Office 11\Project 5\"
Dim Templname As String
Sub userform_initialize()
' Initialize the drop down list choices
ComboBox1.Clear
ComboBox2.Clear
ComboBox3.Clear
ComboBox1.AddItem "Green"
ComboBox1.AddItem "Blue"
ComboBox2.AddItem "River"
ComboBox2.AddItem "Fountain"
ComboBox3.AddItem "Seattle"
ComboBox3.AddItem "Hawaii"
End Sub
Private Sub CommandButton1_Click()
Templname = ComboBox1.Text & ".pot"
Application.ActivePresentation.ApplyTemplate Path & Templname
Set VideoSlide = ActivePresentation.Slides(2).Shapes _
.AddMediaObject(FileName:=Path & ComboBox2.Text & ".wmv", _
Left:=380, Top:=150)
With VideoSlide.AnimationSettings.PlaySettings
.PlayOnEntry = msoTrue
.PauseAnimation = msoTrue
.HideWhileNotPlaying = msoFalse
End With

Set PictureSlide = Application.ActivePresentation.Slides(3)
With PictureSlide
.Shapes.AddPicture Path & ComboBox3.Text & ".jpg", True, True, 375,
150, 300, 300
End With
End Sub
Private Sub CommandButton2_Click()
ActivePresentation.SlideShowSettings.Run
Unload UserForm1
End Sub


For some reason when I click the button "createpresentationtravel" on my
toolbar nothing no form appears. Please help. Thank you

John
 
J

John Wilson

Im no expert on VBA John so take this with a pinch of salt

I think it needs a "userform1.show" added in - could be wrong though
 
J

John

Hi Steve,
Where ... in a module or in the form itself?
I created the form by going to tools> VBA editor. There, I created the form
with few buttons and combo boxes.

I also have a macro button ("creatpresentationtravel") that has the
following code (when I go to VBA editor, I see it as a module):

Sub createpresentationtravel()
UserForm1.userform_initialize
UserForm1.Show
End Sub

And what's supposed to invoke the form?

The macro button that I have above: I go to tools>Customize>Commands tab>
Macros> select the button called "createpresentationtravel" and drag it to
the toolbar. But when I click the button nothing seems to happen.

Thanks.

John
 

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