PDA

View Full Version : PowerPoint 2007 - VBA Code that Distinguishes between Different Master Slides



SASS2007
10-28-2010, 11:45 AM
Hi there,

I'm creating a presentation template in PowerPoint 2007 and am using VBA to create a macro that will update text boxes on multiple master slides with the information provided in a userform.

Basically I have two master slides, one I've called TitleMaster (as this function is no longer available in 2007) and the second is called SlideMaster. When I run the macro, everything works fine for the first slide master, but when it gets to the code for the second master, it displays a run-time error saying that the item is not found.

Here is my code:


'updates TitleMaster slide master with content as provided in userform
ActivePresentation.SlideMaster.Shapes("txtTitleofSub").TextFrame.TextRange.Text = frmData.txtTitleofSub.Value
ActivePresentation.SlideMaster.Shapes("txtMeetDate").TextFrame.TextRange.Text = frmData.txtMeetDate.Value
ActivePresentation.SlideMaster.Shapes("txtEMTExec").TextFrame.TextRange.Text = frmData.txtExecName.Value _
& ", " & frmData.txtExecTitle.Value

'updates SlideMaster slide master with content as provided in userform
ActivePresentation.SlideMaster.Shapes("txtComName").TextFrame.TextRange.Text = frmData.txtComName.Value
ActivePresentation.SlideMaster.Shapes("txtDate").TextFrame.TextRange.Text = frmData.txtMeetDate.Value


The code only stops working when it hits "txtComName" as it appears on the second master slide.

Is there a way to distinguish between different master slides in the above code?

Any help is greatly appreciated!! I know there has to be a way to do it and I'm losing my mind over here :banghead:

Thanks!!