Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7528169
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T04:18:13+00:00 2026-05-30T04:18:13+00:00

I created one code for addin in which my all code runs at one

  • 0

I created one code for addin in which my all code runs at one time after clicking of one button. But now I want to create dropdown list in which I can select any one event for run.

Below is my code for button:

Sub Auto_Open()
    Dim oToolbar As CommandBar
    Dim oButton As CommandBarButton
    Dim MyToolbar As String

    ' Give the toolbar a name
    MyToolbar = "Test"

    On Error Resume Next
    ' so that it doesn't stop on the next line if the toolbar's already there

    ' Create the toolbar; PowerPoint will error if it already exists
    Set oToolbar = CommandBars.Add(Name:=MyToolbar, _
        Position:=msoBarFloating, Temporary:=True)
    If Err.Number <> 0 Then
          ' The toolbar's already there, so we have nothing to do
          Exit Sub
    End If

    On Error GoTo Errorhandler

    ' Now add a button to the new toolbar
    Set oButton = oToolbar.Controls.Add(Type:=msoControlButton)

    ' And set some of the button's properties
    With oButton
         .DescriptionText = "Test_dist"
          'Tooltip text when mouse if placed over button
         .Caption = "Trial"
         'Text if Text in Icon is chosen
         .OnAction = "TEST"
          'Runs the Sub Button1() code when clicked
         .Style = msoButtonIconAndWrapCaptionBelow
          ' Button displays as icon, not text or both
         .FaceId = 1885
         .TooltipText = "Test your presentation"
    End With

    ' You can set the toolbar position and visibility here if you like
    ' By default, it'll be visible when created
    oToolbar.Top = 50
    oToolbar.Left = 150
    oToolbar.Visible = True

NormalExit:

    Exit Sub   ' so it doesn't go on to run the errorhandler code

Errorhandler:
     'Just in case there is an error

     Resume NormalExit:
End Sub 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T04:18:15+00:00Added an answer on May 30, 2026 at 4:18 am

    Try this:

    Dim oDropdown As CommandBarComboBox    
    Set oDropdown = oToolbar.Controls.Add(Type:=msoControlDropdown)
    With oDropdown
        .Clear
        .AddItem ("This")
        .AddItem ("That")
        .AddItem ("The Other Thing")
        ' default it to first item selected
        .ListIndex = 1
        .OnAction = "ProcessDropdown"
    End With
    

    And this to handle the change event of the dropdown:

    Sub ProcessDropdown()
        MsgBox CommandBars("Test").Controls(2).Text
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I created one GWT webapplication project.Inthat i want to create servlet program,but in that
I've created a web application in asp.net. I've to generate embed code for one
I have one custom website with code created 100% by me. I need to
I've created a user control (in vb.net code) that contains two dock panels, one
I created one application to read all the contacts stored in android 2.0 emulator.I
I have created one table using the below command: create table Table1( Id int
I have created one java-swing application. The application runs perfectly runs perfect on my
I've recently created an application which adds items to a Database by CSV. After
I have some Javascript code that creates 2 arrays: One for Product Category and
I had created one HTML page for my experiance. In this i had use

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.