PowerPoint: Allow vba changes after XML noSelect

时间:2018-07-16 15:26:43

标签: xml vba powerpoint powerpoint-vba

So I had a basic VBA macro cycling a set of images in powerpoint. However, it is not particularly robust as people who don't know how to use the macro have a tendency to delete the images and paste in new ones. To protect against this I want to edit the XML of the slide - I have tried using noSelect but this blocks the VBA code as well.

VBA:

Dim oPos As Slide

 If SlideShowWindows.Count > 0 Then

Set oPos = ActivePresentation.SlideShowWindow.View.Slide

Else
 Set oPos = Application.ActiveWindow.View.Slide
 'MsgBox ("Else works 2")
End If

If oPos.Shapes("Picture 41").Visible Then
 oPos.Shapes("Picture 41").Visible = False
 oPos.Shapes("Picture 90").Visible = True
 oPos.Shapes("Picture 37").Visible = False
 oPos.Shapes("Picture 88").Visible = False
 oPos.Shapes("Picture 78").Visible = False
 oPos.Shapes("Picture 35").Visible = False
'''''''''''''''
ElseIf oPos.Shapes("Picture 90").Visible Then
 oPos.Shapes("Picture 41").Visible = False
 oPos.Shapes("Picture 90").Visible = False
 oPos.Shapes("Picture 37").Visible = True
 oPos.Shapes("Picture 88").Visible = False
 oPos.Shapes("Picture 78").Visible = False
 oPos.Shapes("Picture 35").Visible = False

XML

p:nvPicPr>
                <p:cNvPr id="42" name="Picture 41">
                    <a:hlinkClick r:id="" action="ppaction://macro?name=lt"/>
                </p:cNvPr>
                <p:cNvPicPr>
                    <a:picLocks noChangeAspect="1" noSelect="1"/>
                </p:cNvPicPr>
                <p:nvPr/>
            </p:nvPicPr>

Thanks for the help

0 个答案:

没有答案