?
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
Medium Priority
?
665 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 2000 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Setting the Scene PowerPoint is a creative tool in the right hands but it also includes a much underutilised programming dimension. In this beginner level article, we're going to show you some of some key elements of programming PowerPoint using th…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
This video teaches viewers how to add simple and professional themes to their slides.
This video teaches viewers how to create handouts from their slides and helps them decide how many slides to include per handout.

840 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