0

I am hoping to set all of the togglebuttons in a powerpoint to "false" (unpressed) upon starting the program. Any ideas why this sort of code is working?

Sub Start()
ActivePresentation.Slides(4).ToggleButton1.Value = 0
ActivePresentation.Slides(4).ToggleButton4.Value = 0

ActivePresentation.SlideShowWindow.View.Next

End Sub

Thank you!

2 Answers 2

0

The syntax

ActivePresentation.Slides(4).ToggleButton1.Value = 0

is correct; I've just tested it and it works.

Are you actually calling the Sub at any point though? Simply naming it Start() is not enough.

Related question re. running code on startup, could be helpful.

1
  • I replied elsewhere that ToggleButton isn't a supported type. You're correct, it is. And I see that Matt's got the rest of the details worked out. Aug 22, 2014 at 23:39
0

I had an issue calling this

ActivePresentation.Slides(4).ToggleButton1.Value = 0

Getting the error Method or data member not found which im assuming is a scope issue. The VBA editor doesnt autocomplete .ToggleButton1 which supports the error i was getting. So, it appears im referencing the object incorrectly.

To correct this I have done the following.

Public Sub ToggleThisButton()
    ' This is code on Slide 1 referencing control on slide 4
    ActivePresentation.Slides(4).Shapes("ToggleButton1").OLEFormat.Object.Value = 1
End Sub

Excerpt from MSDN

Use the OLEFormat property for a shape, inline shape, or field to return the OLEFormat object. The following example displays the class type for the first shape on the active document.

Use the Object property to return an object that represents an ActiveX control or OLE object. With this object, you can use the properties and methods of the container application or the ActiveX control.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.