DBDivaAuto
IS-IT--Management
It's been a while since I have had to code something in PowerPoint (as in over 4 years) and things have changed a bit. I would like a piece of code to run when the presentation is done opening.
We have slides that get uploaded to a file documentation system and when they do, it changes whatever the file name is to the Document Number and Version. If someone downloads to their machine, we want to replace the Rev # with the document title so it's all consistent. I can run the OnLoadCode manually and it does what I expect. How in Powerpoint can this happen with a mouse motion, on load, etc?
Any help is appreciated.
We have slides that get uploaded to a file documentation system and when they do, it changes whatever the file name is to the Document Number and Version. If someone downloads to their machine, we want to replace the Rev # with the document title so it's all consistent. I can run the OnLoadCode manually and it does what I expect. How in Powerpoint can this happen with a mouse motion, on load, etc?
Any help is appreciated.
Code:
Public App As Application
Private Sub App_AfterPresentationOpen(ByVal Pres As Presentation)
With Pres
OnLoadCode
End With
End Sub
'Sub Auto_open()
' OnLoadCode
'End Sub
Sub OnLoadCode()
Dim sld As Slide
Dim shp As Shape
Dim fileName As String
Set sld = ActivePresentation.Slides(1)
fileName = Replace(Application.ActivePresentation.Name, ".pptm", "")
'MsgBox fileName
For Each shp In sld.Shapes
If shp.HasTextFrame Then
If shp.TextFrame.HasText Then
shp.TextFrame.TextRange.Text = Replace(shp.TextFrame.TextRange.Text, "1", fileName)
End If
End If
Next shp
End Sub