Using VB in Excel 2007 to go to specific slide in PowerPoint 2007

firechinwessel

New Member
Joined
Jul 29, 2011
Messages
7
I am trying to write a code that would allow me to click a button so that it would automatically send me to a specific slide from a specific powerpoint presentation. I cannot for the life of me figure out how to get it. Here is what I have so far...

Private Sub cmdOne_Click()

Set PPapp = GetObject(, "PowerPoint.Application")
Set PPres = PPapp.ActivePresentation

With PPapp
.Activate
End With


End Sub


Is there any way to do this? Also, I am writing this code with the intent of being able to quickly find one slide out of 300 so that I can make another presentation. If anyone knows how to be able to directly take one slide from a template and put it into a brand new presentation without ever having to open the template presentation, that would be awesome as well. But priority one for me is being able to find a specific slide.

I am still new to visual basic programming in general so any tips or advice on how to get this to work would be greatly appreciated.

Thanks!
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
Is this during a slide show or when the presentation is being viewed in 'design' mode?
 
Upvote 0
Thanks for the quick response! It will be in design mode. I want to create something like a "clickable" flowchart. I present a question in Excel with answers made of buttons. When I click the button with the answer, a specific slide is brought up from a template powerpoint and I immediately know that that slide can be copied and pasted into the new powerpoint that I am creating.

There are a grand total of 20 questions that have multiple answers, depending on the situation presented by the individual answering them. Therefore, each individual must have a personalized presentation, which is why I thought this might be the best option. Otherwise, I would have to spend hours running through hundreds of slides trying to find the right one.

I really hope I am explaining this well enough. Thank you for your help and patience!
 
Upvote 0
Do you have a presentation that has all the slides you need?

If you do you could use that as a sort of template, creating a new presentation by copying slides from it based on the user's response.

eg Option1 - if user picks Yes then Slide2 is added to new presentation, if they pick No Slide3 is added

Obviously your logic is going to be a bit more complicated than that, but does the idea make sense?
 
Upvote 0
Yes. That is exactly what I am doing. Glad you were able to understand my ramblings! I have a presentation with all the slides that will be needed. I have the Excel spreadsheet with the questions. I thought about simply making another presentation to put the questions in, adding hyperlinks and whatnot but that idea seems like it would complicated and take a long time to develop. This idea, while complicated, will be easier in my opinion as soon as I can get the right code to work. And that's my problem. The codes I have tried have not worked. Any ideas?
 
Upvote 0
What have you tried, apart from the short piece of code you posted?

I think there are 2 approachs you could take.


1 Run through all the questions, noting all the answers, then at the end create the new presentation.

2 Create the presentation as you go, eg questioned answered copy sheet etc

I think 1 would be the best idea but how to store the answers would depend on the 'overall' logic.

Make any sense?
 
Upvote 0
Somehow I managed to figure it out literally two seconds ago. I ended up with the code

Code:
Private Sub cmdOne_Click()
     Set PPapp = GetObject(, "PowerPoint.Application")
    
    With PPapp
        .Activate
        .ActivePresentation.Slides(3).Select
    End With
    
End Sub

Now I can directly go to the slide I want. However, now that I've figured that out, is there another way where I can just tell it to copy that slide and paste it into my new presentation? That way I can save time by not always having to copy and past a slide myself and so I don't have to have Excel and the two powerpoints running at once.
 
Upvote 0

Forum statistics

Threads
1,224,595
Messages
6,179,798
Members
452,943
Latest member
Newbie4296

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