For PowerPoint VBA, there are two ways to control (access) ActiveX controls in certain slide from standard module.
Assume we want to get or set the value of toggle button, then we can do this using one of the following worked examples:
Example 1:
In module code, use the following code:
'
Declare a public variable for toggle button value in module code
Public
ToggleBtnValue As Boolean
'
Sub-routine to call another sub-routine in slide 1
Sub
SetToggleBtnValue()
ToggleBtnValue=True
Call
Slide1.UpdateToggleBtn
End
Sub
|
In slide 1 code, use the following code:
'
In slide 1 code
Sub
UpdateToggleBtn() 'Don't use "Private
Sub"
MyToggleBtn.Value=
ToggleBtnValue
End
Sub
|
Example 2:
In module code, use the following code:
'
Read toggle button value in slide number 1
ToggleBtnValue=SlideShowWindows(1).Presentation.Slides(1).Shapes("MyToggleBtn").OLEFormat.Object.value
'
Set value of toggle button in slide number 1
SlideShowWindows(1).Presentation.Slides(1).Shapes("MyToggleBtn").OLEFormat.Object.value=False
|
The previous methods can be used to read or write any of the ActiveX control properties like back color, font name, font size, ... etc.
No comments:
Post a Comment