Results 1 to 5 of 5

Thread: [RESOLVED] VB6/VBA - populate combo box in powerpoint presentation

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2007
    Posts
    341

    Resolved [RESOLVED] VB6/VBA - populate combo box in powerpoint presentation


    Hello everyone,
    I have a powerpoint presentation. On one of my slides, I would like to add a combo box. I would like to populate the combox box with some values.

    Question1:
    Where and how do I put in the vb or vba code in designing this presentation?

    Question2:
    How do I go about populating this combo box with my values?

    Note: I want this combox box to be operational when I run the presentation.
    This is a new gig for me, so a clear explanation will be much appreciated.
    Thanks.
    GiftX.

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: VB6/VBA - populate combo box in powerpoint presentation

    Where will the values becoming from? Are you using a database?

  3. #3
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,710

    Re: VB6/VBA - populate combo box in powerpoint presentation

    Just drop a combobox on to your slide and use code like below to popuate it with your desired items.. It will be functional during playback.

    Code:
    Option Explicit
    
    Sub LoadMe()
        ComboBox1.AddItem "Test1"
        ComboBox1.AddItem "Test2"
        ComboBox1.AddItem "Test3"
        ComboBox1.AddItem "Test4"
        ComboBox1.ListRows = 4
    End Sub
    
    Private Sub ComboBox1_GotFocus()
        If ComboBox1.ListCount = 0 Then
            LoadMe
        End If
    End Sub
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2007
    Posts
    341

    Re: VB6/VBA - populate combo box in powerpoint presentation

    Thanks guys. All your codes worked for me.
    Have a great weekend you all.
    GiftX.

  5. #5
    New Member
    Join Date
    Apr 2021
    Posts
    1

    Re: VB6/VBA - populate combo box in powerpoint presentation

    Quote Originally Posted by RobDog888 View Post
    Just drop a combobox on to your slide and use code like below to popuate it with your desired items.. It will be functional during playback.

    Code:
    Option Explicit
    
    Sub LoadMe()
        ComboBox1.AddItem "Test1"
        ComboBox1.AddItem "Test2"
        ComboBox1.AddItem "Test3"
        ComboBox1.AddItem "Test4"
        ComboBox1.ListRows = 4
    End Sub
    
    Private Sub ComboBox1_GotFocus()
        If ComboBox1.ListCount = 0 Then
            LoadMe
        End If
    End Sub
    Very old post But I want to ask again. How can we change this code to work during edit mode? Codes are working during presentation mode only.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width