How to create a "search" button in a slide show

D

Didier Rousselle

I want to create a knowledge database in PowerPoint. I will use several entry
gates, some through hyperlinks created on on menu names located in the slide
show and directing the user to these menu after hitting the menu names. Next
to these menu names, I was wondering whether the knowledge data base user
could, without entering the edit mode (and therefore still whine in slide
show mode), click on a "search" button and enter the name of a topic he is
interested in.

Many thanks for your response.
 
B

Bill Dilworth

Yes, but ...

There are much better tools for doing database work, really. PowerPoint is
a presentation software, and is not the most stable when it comes to keeping
data safe.

It is not a native function, so you will need to build the tool from the
ground up using VBA or other code. This means each function and field will
need to be defined, designed, coded, and debugged. This is not a small
project.

VBA does not work in the viewer, on machines without its software support
code installed, or on an user with Macro Security set to High or above.

If you do all this and run it on the right machine, it can be done.
However, I fear that the Wow factor with be somewhat less than the Oww
factor.


--
Bill Dilworth
A proud member of the Microsoft PPT MVP Team
Users helping fellow users.
http://billdilworth.mvps.org
-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
vestprog2@ Please read the PowerPoint FAQ pages.
yahoo. They answer most of our questions.
com www.pptfaq.com
..
 
R

rangana

hi didier,

I am uncertain with this suggestion, but i'm hoping this will help. Why not
insert an input box and search button in your slide show then do work out
with the codes.
For example, if the user will key in "love" and love was in the 78th slide,
then the search button will navigate the user to the 78th slide. To insert an
input box and a search button, follow these steps: On the menu bar, click
View -> Toolbars then check the "Control Toolbox". In the control toolbox,
click the "textbox" button and insert it in your slide then click the
"command button". Please post back for whatever help I can offer.

thanks.
 
H

Haggistech

I think he might be looking for the same thing as me, its easy to insert the
text box and the search button but the actual code to do the search is the
problem

i have managed to make all the text bold for example that i search for but i
cant work out how to make it jump to the page it finds the text on
 
H

Haggistech

Steve Rindsberg said:
Do you want to do this in normal editing view or in a slide show?





==============================
PPT Frequently Asked Questions
http://www.pptfaq.com/

PPTools add-ins for PowerPoint
http://www.pptools.com/


.

Within a slide show

If possible i want to have a search button will pop up a inputbox when
entered will take you to the first instance of the search and pop up a form
with a find next button
 
H

Haggistech

Steve Rindsberg said:
It might be simpler to have the search button pop up a form in the first place with a
text box control for the "Find:" text and a "Find Next" button the user can click to
initiate the search and perhaps a "New Search" button they can use to "clear" the
search.

I've written a little function and some test code that'll do the bulk of the work.

You call the function once with just the search string as a parameter to find the first
ocurrence of the text; if found, it returns the index of the slide the text was found
on; zero otherwise.

For subsequent searches, you call the function with the same search text and two zeros
as parameters.

If for some reason you want to start searching at a slide or shape number other than 1
you can pass the starting numbers as parameters as well.

Note that since it only checks each shape once, it's only going to find a given search
string once per shape, even if the shape has more than one instance of the string.

The test routine's written to run in normal view. For slide show view, youd' want to
use:

SlideShowWindows(1).View.GoToSlide lTemp

instead

Option Explicit

Sub TestTheFunction()
Dim lTemp As Long

' find the first occurrence
lTemp = FindTheText("now")
If lTemp > 0 Then
ActiveWindow.View.GotoSlide lTemp
MsgBox "Click to continue"
End If

' find the next occurrence(s)
While lTemp > 0
lTemp = FindTheText("now", 0, 0)
If lTemp > 0 Then
ActiveWindow.View.GotoSlide lTemp
MsgBox "Click to continue"
End If
Wend

End Sub
Function FindTheText(sFindString As String, _
Optional lStartSlide As Long = 1, _
Optional lStartShape As Long = 1) As Long

' Returns the slide index of the slide the searchtext was found on
' if any

Dim oSl As Slide
Dim oSh As Shape
Dim x As Long
Dim y As Long

' Static vars to record highest previously searched
' slide and shape numbers
Static lSlideNum As Long
Static lShapeNum As Long

' are we starting a new search/resetting?
' if so, lStartSlide/lStartshape will both be 1
Select Case lStartSlide + lStartShape
Case 0
' we're continuing the search
' don't reset the counters
Case 2
' new search; reset both counters
lSlideNum = 1
lShapeNum = 1
Case Else
' we're starting from a specific position
lSlideNum = lStartSlide
lShapeNum = lStartShape
End Select

With ActivePresentation
For x = lSlideNum To .Slides.Count
Set oSl = .Slides(x)
With oSl
For y = lShapeNum To .Shapes.Count
Set oSh = .Shapes(y)
With oSh
If .HasTextFrame Then
If .TextFrame.HasText Then
If InStr(UCase(.TextFrame.TextRange.Text), _
UCase(sFindString)) > 0 Then
' FOUND ONE; record position
lSlideNum = x
lShapeNum = y + 1
' return slide index
FindTheText = oSl.SlideIndex
' and stop
Exit Function
End If ' Instr
End If ' Has text
End If ' has text frame
End With ' oSh
Next ' Shape
End With ' slide
lShapeNum = 1
Next ' slide
End With

' text not found, return 0
FindTheText = 0

End Function






==============================
PPT Frequently Asked Questions
http://www.pptfaq.com/

PPTools add-ins for PowerPoint
http://www.pptools.com/


.



I cant get this to work
 
H

Haggistech

Sorry

what should i be pulling the text from

in the function is that searching for the word "now"?

if i have a button to click to search how should i be calling the macro
 

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