PDA

View Full Version : ActiveX Controls... Another Question!



messinho
06-02-2008, 08:30 AM
In other post: ../showthread.php?t=19916 I discover how to loop through the ActiveX controls (option buttons, checkboxes,...) in one presentation.

Private Sub CommandButton1_Click()
Dim sldTemp As Slide
For Each sldTemp In ActivePresentation.Slides
Dim shpTemp As Shape
For Each shpTemp In sldTemp.Shapes
If shpTemp.Type = msoOLEControlObject Then
If TypeName(shpTemp.OLEFormat.Object) = "CheckBox" Then
shpTemp.OLEFormat.Object.Value = False
End If
End If
Next
Next
End Sub Now, I need to know, how can I access a specific control using his "name property". Here is a Excel VBA code that uses a similar idea.


For i = 1 To 4
strAcell = "a" & i
strBcell = "b" & i
strCcell = "c" & i
strDcell = "d" & i
'...
ograph.Application.DataSheet.Range(strAcell).Value = 20 * i
ograph.Application.DataSheet.Range(strBcell).Value = 20 * i
ograph.Application.DataSheet.Range(strCcell).Value = 20 * i
ograph.Application.DataSheet.Range(strDcell).Value = 20 * i
'...
Next i
Thanks, Messinho

~Cleaned up post. Please don't nest board tags inside VBA tags :)
Regards, Oorang

Andy Pope
06-02-2008, 12:00 PM
If you know the shapes name then you can use


Activepresentation.slides(1).shapes("Name").???


Where "Name" is the name of the control and ??? is properties of the shape.