Steve, thanks for response.
I'm game for either option, albeit it'll be easier for me
if existing add-ins or vba subs are available.
there's always a first time? for everything <g>
You just never know when something might tickle someones fancy. For example, this might
happen:
Save your presentation to a folder of your choice.
Create or copy a text file of phrases into that folder. It must be a plain ascii text file
(something Notepad can read, for example) and it must be named PHRASES.TXT. It should have
one phrase per line.
Add a new module in the VBA editor and paste in the code below.
Edit PlacePhrases as needed to alter the text formatting.
Run PlacePhrases to put a phrase from your text file on every slide (except title slides) in
the presentation
The phrases will be chosen at random, but you can alter GetPhrase to change this.
Run DeletePhrases to remove all the phrases added by PlacePhrases
''' CODE STARTS HERE -- COPY AND PASTE EVERYTHING BELOW BUT NOT INCLUDING THIS LINE
Public rayPhrases() As String
Sub PlacePhrases()
' Puts a phrase in the same position on every slide in a presentation
' Excludes title slides
Dim oSl As Slide
Dim oText As Shape
ReDim rayPhrases(1 To 1) As String
' Load an array of phrases to use
Call InitPhrases
For Each oSl In ActivePresentation.Slides
' Skip Title slides
If Not oSl.Layout = ppLayoutTitle Then
' Add the textbox
Set oText = oSl.Shapes.AddTextbox(msoTextOrientationHorizontal, 0#, 0#, 100#,
24#)
' Add text and format it
With oText.TextFrame
.WordWrap = msoFalse
With .TextRange
' GetPhrase should return the next phrase to be used
.Text = GetPhrase
With .Font
.Name = "Arial"
.Size = 24
.Bold = msoFalse
' whatever other defaults you like here
.Color.RGB = RGB(255, 0, 0) ' Red
End With
End With
End With
' Tag it so we can find and remove it later
Call oText.Tags.Add("PHRASE", "PHRASE")
End If
Next oSl
End Sub
Function GetPhrase() As String
' Returns a random phrase from the array of phrases
Dim lTodaysPhrase As Long ' index into array of phrases
lTodaysPhrase = Int((UBound(rayPhrases) - LBound(rayPhrases) + 1) _
* Rnd + LBound(rayPhrases))
GetPhrase = rayPhrases(lTodaysPhrase)
End Function
Sub InitPhrases()
' Loads array of phrases - rewrite to suit your needs
' This version uses a file of phrases in the same folder as current presentation
' Filename = PHRASES.TXT
' ASCII file, one phrase per line
Dim PhraseFile As String
Dim FileNum As Integer
Dim Buffer As String
PhraseFile = ActivePresentation.Path & "\" & "PHRASES.TXT"
FileNum = FreeFile()
Open PhraseFile For Input As FreeFile
While Not EOF(FileNum)
Line Input #FileNum, Buffer
Call AddAPhrase(rayPhrases, Buffer)
Wend
Close #FileNum
' This leaves the array with one bogus empty record at end so
ReDim Preserve rayPhrases(1 To UBound(rayPhrases) - 1) As String
End Sub
Sub AddAPhrase(Phrases As Variant, Phrase As String)
' adds a new phrase to the array
Phrases(UBound(Phrases)) = Phrase
ReDim Preserve Phrases(1 To UBound(Phrases) + 1) As String
End Sub
Sub DeletePhrases()
' deletes all the phrases we added
Dim oSl As Slide
Dim oSh As Shape
Dim X As Long
For Each oSl In ActivePresentation.Slides
For X = oSl.Shapes.Count To 1 Step -1
If oSl.Shapes(X).Tags("PHRASE") = "PHRASE" Then
oSl.Shapes(X).Delete
End If
Next X
Next oSl
End Sub