Need to figure out how to create drop down list in Powerpoint using developer option

Bridget Shoulders 0 Reputation points
2026-08-02T23:40:17.5466667+00:00

I've watched the few videos and read articles I can find on this topic but still cannot figure out how to create a drop down list in powerpoint, using developer option. When I get to the point of entering my data in the code field:

End Sub

ComboBox1.AddItem "Problem"

ComboBox1.AddItem "Acute Respiratory Failure"

ComboBox1.AddItem "Cardiogenic Shock"

ComboBox1.AddItem "Pneumonia"

ComboBox1.AddItem "Hypovolemic Shock"

 ComboBox.ListRows = 5

 End Sub

Once saved, I get a message "compile error: invalid outside procedure" I'm not a coder or programmer and have never done this before (able to do without a problem in Word). Most of the information available assumes everybody knows how to do this and seems like basic steps are left out. Please help!

Developer technologies | Visual Basic for Applications

1 answer

Sort by: Most helpful
  1. Danny Nguyen (WICLOUD CORPORATION) 8,015 Reputation points Microsoft External Staff Moderator
    2026-08-03T04:00:13.5533333+00:00

    Hi @Bridget Shoulders ,

    The error "Compile error: Invalid outside procedure" occurs because the code you pasted is not enclosed within a valid procedure block (a Sub or Function). You also have an extra End Sub at the very beginning of your code. In VBA, any executable code (like adding items to a ComboBox) must live inside a procedure.

    Additionally, near the bottom of your code, you refer to ComboBox.ListRows = 5 lacking the 1 — it should be ComboBox1 to match the rest of the lines.

    To fix your issue, clear out your old code and replace it with a properly formulated Subroutine.

    For example, if you place the code within the module for the slide containing the ComboBox (e.g., double-clicking the ComboBox in Developer Mode will usually take you there), you can use the DropButtonClick event to populate the list the moment you try to open the dropdown in Slide Show mode:

    Private Sub ComboBox1_DropButtonClick()
        ' Ensure the list hasn't already been populated to prevent duplicates
        If ComboBox1.ListCount = 0 Then
            ComboBox1.AddItem "Problem"
            ComboBox1.AddItem "Acute Respiratory Failure"
            ComboBox1.AddItem "Cardiogenic Shock"
            ComboBox1.AddItem "Pneumonia"
            ComboBox1.AddItem "Hypovolemic Shock"
    
            ' Fixed typing error: ComboBox -> ComboBox1
            ComboBox1.ListRows = 5
        End If
    End Sub
    

    Alternatively, if you just want to run a macro manually to populate the dropdown once while designing, you can use:

    Sub PopulateComboBox()
        ComboBox1.Clear ' clear any old items
    
        ComboBox1.AddItem "Problem"
        ComboBox1.AddItem "Acute Respiratory Failure"
        ComboBox1.AddItem "Cardiogenic Shock"
        ComboBox1.AddItem "Pneumonia"
        ComboBox1.AddItem "Hypovolemic Shock"
    
        ComboBox1.ListRows = 5
    End Sub
    

    To run this manual setup, just click anywhere inside the Sub PopulateComboBox() and press F5 or click the green "Run" arrow in the VBA Editor toolbar.

    If you found my response helpful or informative, I would greatly appreciate it if you could follow this guidance or provide feedback.

    Thank you. 

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.