How to check if footer exist in SlideMaster?

G

Guest

Hi,

I needed to make use of macros to do some checking. If the slideMaster
do not have a footer, I will add in one. If not I will just ignore. I
have a line of code to add in the footer in the master slide but i do
not know how to check if footer exist in the slideMaster a not. If
there is no footer the line of code will run well but if a footer is
already exist, it wil show me a run-time error message as shown below.
Does anyone know how to write macros to do a checking on the existance
of the footer. Help will be greatly appreciated. Thanks in advance.

Run-time error - '2147188160(80048240)':

Shape(unknown member) : Invalid request. Slide already contains maximun
placeholders of this type.
 
S

Steve Rindsberg

Kiwilife said:
Hi,

I needed to make use of macros to do some checking. If the slideMaster
do not have a footer, I will add in one. If not I will just ignore. I
have a line of code to add in the footer in the master slide but i do
not know how to check if footer exist in the slideMaster a not. If
there is no footer the line of code will run well but if a footer is
already exist, it wil show me a run-time error message as shown below.
Does anyone know how to write macros to do a checking on the existance
of the footer. Help will be greatly appreciated. Thanks in advance.

Run-time error - '2147188160(80048240)':

Shape(unknown member) : Invalid request. Slide already contains maximun
placeholders of this type.

The simplest way out would be to let it error, trap the error if it occurs and
deal with it

On Error Resume Next
' attempt to add the placeholder
If Err.Number > 0 Then
' there was already a placeholder
Else
' no problem
End If


Or you could use a function like this:

Function FooterPlaceholder() as Shape
Dim oSh as Shape
For Each oSh in ActivePresentation.SlideMaster.Shapes.Placeholders
If oSh.PlaceholderFormat.Type = ppPlaceholderFooter Then
Set FooterPlaceholder = oSh
End If
Next
End Function

Then:

If FooterPlaceholder Is Nothing Then
' No placeholder, add one
End If
 

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