Link to home
Start Free TrialLog in
Avatar of tom y
tom y

asked on

Clearing ComboBox in Power point

Hi All,
I have two ComboBox in a macro-enabled powerpoint presentation. These Combobox represent a start-date and an end-date. The following piece of code clears the combobox, but not if the presentation opens with dates already present. So let's say you open the power point presentation, and the dates from when the presentation was previously given were still in the Combobox, if I try to apply this code...nothing happens. But if I adjust the dates in the combo box and apply the code again, it works and the combobox's are cleared. Strange! Any ideas?
Dim j As Long
Dim cb As Object

For j = 1 To 2
Set cb = Slide1.Shapes("ComboBox" & j).OLEFormat.Object
cb.Clear
Next j

'Clean up
 Set cb = Nothing

I am aware it is possible to clear these combo box by utilising the above with  PresentationOpen(ByVal Pres As Presentation) , but this requires an add-in. Is it possible to do this without an add-in? If so, how? Associate it with another event?
ASKER CERTIFIED SOLUTION
Avatar of Rgonzo1971
Rgonzo1971

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of tom y
tom y

ASKER

worked like a dream...D'oh. Should have thought of that!
Avatar of tom y

ASKER

Possibly we should use vbNullString instead of ""
If you prefer, it should work as well
Avatar of tom y

ASKER

It does, cheers