Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBA PowerPoint Find/Exit or Close Application/User Form

Status
Not open for further replies.

kath12

MIS
Jun 6, 2001
3
US
1) Find Function (Ctrl + F)

Okay. I want to be able to utilize the find function in a presentation format to search for a word, phase, or whatever like you can when you want to edit the document.

Is this available through a macro/VBA code?

2) "Exit All" function

Okay. This is the simple code I want to enable:

(Private or Sub) cmdExit_Click()

Application.Quit

End Sub


When you have one presentation open, this works fine to shut downt without having to close out the presentation, and then the application itself. However, when you have multiple presentations linked together, I believe PowerPoint gets a little confused about closing all of the applications and fails to close anything.

3) User Forms

How do you apply/implement a User Form through a macro using VBA in PowerPoint??? I can design a form and write code for it, but I cannot get it to run. It is not an .exe file like it is using VB 6.0, so what do you do.

 
1. Look on VBA Help for Find Method.
This example is from powerpoint.

This example finds every occurrence of "CompanyX" in the active presentation and formats it as bold.

For Each sld In Application.ActivePresentation.Slides
For Each shp In sld.Shapes
If shp.HasTextFrame Then
Set txtRng = shp.TextFrame.TextRange
Set foundText = txtRng.Find(FindWhat:="CompanyX")
Do While Not (foundText Is Nothing)
With foundText
.Font.Bold = True
Set foundText = txtRng.Find(FindWhat:="CompanyX", _
After:=.Start + .Length - 1)

End With
Loop
End If
Next
Next

2. Not sure why that doesn't work try writing some code to close all presentations before using application.quit

3. You need to show the user form.
use this. Userform1.Show where Userform1 is the name of the form.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top