VBA in Powerpoint Issues

Joined
Sep 11, 2012
Messages
1
Reaction score
0
Hi All, it's been a LONG time since I did any VBA coding and I've never tried in Powerpoint. I'm trying to write two macros with the ultimate goal of upadting a text field on each page of the presentation with the text value that the user has inputted into an input box. Please can anyone help me? Also, any suggestions for good VBA courses or books would be great! Thanks Rachel. :confused:

Here's what I'm trying to do at each step and what I've got so far:

Macro 1:
1. Select shape (text box) on slide 2
2. Call it "watermark"
3. Go onto the next side and repeat until all slides have been done

Macro 2:
1. Go to slide 2
2. Find the text box called "watermark"
3. Overwrite the existing text with whatever the user types into the input box
4. Go onto the next side and repeat until all slides have been done

For Macro 1 I have used:
Sub NameShape()
Dim Name$
On Error GoTo AbortNameShape
If ActiveWindow.Selection.ShapeRange.Count = 0 Then
MsgBox "No Shapes Selected"
Exit Sub
End If
Name$ = ActiveWindow.Selection.ShapeRange(1).Name
Name$ = InputBox$("Give this shape a name", "Shape Name", Name$)
If Name$ <> "" Then
ActiveWindow.Selection.ShapeRange(1).Name = Name$
End If
Exit Sub
AbortNameShape:
MsgBox Err.Description
End Sub

For macro 2, I've got as far as:

Sub Watermark()
Dim strResponse As String
strResponse = InputBox("Enter CDSID for Watermark")
ActivePresentation.Slides(1).Shapes("watermark").TextFrame.TextRange.Text = strResponse
End Sub
 

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