PowerPoint If Statement to open a UserForm

MHamid

Active Member
Joined
Jan 31, 2013
Messages
472
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
Hello,

I was wondering if it is possible to use a vba code that will open a UserForm based on the current open slide in Normal/Edit View?

I tried the code below, but I'm getting an error message (Object variable or With block variable not set.
Code:
Sub UserForm()
Dim ActiveSlide As Slide
If ActiveSlide = ActivePresentation.Slides(1) Then
    frmChecklist.Show vbModeless
End If
End Sub

What I need to do is:
  • If Slide 0 is the current active presentation slide, then open userform1.
  • If Slide 1 is the current active presentation slide, then open userform1 and userform2.
  • etc.

Thank you
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
This is an excel forum but as help you could use something like this:

Code:
Dim sld As Slide

Set sld = ActiveWindow.View.Slide

Select Case sld.Name
    Case ActivePresentation.Slides(1).Name
        UserForm1.Show vbModeless
    Case ActivePresentation.Slides(2).Name
        MsgBox "Slide 2"
End Select
 
Upvote 0
Hello,

Thank you. I understand that this is an Excel forum, but I really needed the help and was not sure where else to go to get some help quickly.
Would you happen to know if there is a way to get this work that when a user goes to the slide, the UserForm will automatically open instead of clicking on the macro to run if per slide?

Thank you
 
Upvote 0
Hello,

I need some suggestions or some direction.

Thank you
 
Upvote 0
Can someone at least direct me to a forum for PowerPoint VBA questions?
 
Upvote 0

Forum statistics

Threads
1,223,908
Messages
6,175,307
Members
452,633
Latest member
DougMo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top