Solved

In VBA for PowerPoint 2010, how do I use the built-in "Find" dialog's "Find Next" function?

Posted on 2013-12-30
1
640 Views
Last Modified: 2014-01-12
Hello all.

This is about VBA for PowerPoint 2010. The goal is to use PPT's built-in "Find Next" function that is accessed through the "Find" dialog, instead of having to write code to loop through slides, shapes and text ranges, which seems ridiculously redundant!

I found that the control id for the "Find" dialog is 141, and the control id for the "Find Next" button is 570 (correct me if I'm wrong or off track).

I can display the "Find" dialog like so:
CommandBars.FindControl(id:=141).Execute

But when I try to use the "Find Next" button the same way I get a "Object variable of With block variable not set" error:
CommandBars.FindControl(id:=570).Execute

Actually I don't even want to display the dialog; I just want to use its functions behind the scene...

So, first I need to know how to paste a string in the "Find what" combobox (or something to that effect). By the way, I tried pasting after the dialog is called, but the paste is done on the slide instead of in the combobox...

Then I need to know, using VBA, how to activate the "Find Next" button (or something to that effect). Preferably this would involve a more civilized method than "send keys"...

Can anyone help?
0
Comment
Question by:RIBBIT_Productions
1 Comment
 
LVL 23

Accepted Solution

by:
JSRWilson earned 500 total points
ID: 39761763
You could probably open and paste in text like this and "click" the button.

CommandBars.ExecuteMso ("FindDialog")
DoEvents
SendKeys ("^v")
DoEvents
CommandBars.ExecuteMso ("FindNext")

But why??

There will be all sorts of problems with losing focus on the search dialog and proesumably you have to click something to initiate "Find Next" so why not the find next button.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Outline From PowerPoint 2010 it is possible to have shapes appear in front of video, in earlier versions video always played in front of other shapes. This means it is possible to have captions animated to appear in front of video. Users who h…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
The viewer will learn how to edit animations within the presentation, incorporate sound, and set everything up with timing.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now