Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / General PowerPoint Questions / June 2006

Tip: Looking for answers? Try searching our database.

Using VBA, Add data to the combo box list upon creation of the obj

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
matthewmark - 15 Jun 2006 15:14 GMT
Powerpoint with Office 2003

Is this possible. I've combed the net and MSDN and all instances of
populating a combo box list seem to work only when you manually "Edit" the
shape after creating it. When attempting to do it through the vba code that
is creating the combo box, I can't get it to work.

I've tried variations of creating the box. This, below, is my last one. I
can't find a way for the code to recognize the additem method. I only had
luck manually entering it into the code change event for the newly created
combo box.

I guess the question might be, can you, with VBA, create a sub procedure
when creating the combo box?
*******************
Public Sub AddPPTComboBox(app As PowerPoint.Application, dblLeft As Double,
dbltop As Double, dblWidth As Double, dblheight As Double, strname As String)
On Error GoTo errhandler

Dim shp As Object
Set shp =
app.ActiveWindow.Selection.SlideRange.Shapes.AddOLEObject(Left:=dblLeft, _
Top:=dbltop, Width:=dblWidth, Height:=dblheight,
ClassName:="Forms.ComboBox.1", Link:=msoFalse)

Exit Sub
errhandler:
  MsgBox Err.Number & ":  " & Err.Description, , "AddPPTComboBox"
End Sub
***************************

Matthew Mark
Steve Rindsberg - 15 Jun 2006 16:39 GMT
> Powerpoint with Office 2003
>
[quoted text clipped - 28 lines]
>
> Matthew Mark

Easier, perhaps, if you Dim shp as Shape, but not necessary.

Having created shp you can:

With shp.OLEFormat.Object
  ' do anything you'd normally do with
  ' combobox properties/methods on a form
  .AddItem("This")
  .AddItem("That")
  .AddItem("The other")
End with

-----------------------------------------
Steve Rindsberg, PPT MVP
PPT FAQ:  www.pptfaq.com
PPTools:  www.pptools.com
================================================
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.