Hi,
I am a bit new to PowerPoint VBA and wondering if its possible to Design a ribbon addin with either dropdown list or combo box and then use the values to run some sub routine.
So I have created PowerPoint Ribbon Addin with a DropDown with items showing as "Depart 1", "Depart 2" & "Depart 3" and then one button to say import excel. So Idea is user can first select which department they want to prepare the slides for. Once the department is selected then they can run the report which will copy the charts from the designated excel.
Below code is an example to show what I am trying to do. In this when I select department in drop down list; I get the message which department is selected from Drop Down. But when I want to use that as variable, my code did not recognise it.
Below is XML code I am having for Ribbon Addin:
<ribbon>
<tabs>
<tab id="CustomTab" label="TestLabel">
<group id="SampleGroup" label="BU Selection">
<dropDown id="DdropDown" label="Select Dept" onAction="DReportSelection" getSelectedItemIndex = "DropDown_OnGetSelectedItemIndex">
<item id="item1" label="Depart 1" />
<item id="item2" label="Depart 2" />
<item id="item3" label="Depart 3" />
</dropDown>
</group >
<group id="SampleGroup1" label="TestLabel">
<button id="Button" label="Import Excel" imageMso="MicrosoftExcel" screentip="Import Data from Excel" size="large" onAction="ExcelImport" />
</group >
</tab>
</tabs>
</ribbon>
</customUI>
Below is VBA I am having in my presentation.
Sub BUReportSelection(control As IRibbonControl, ID As String, selectedindex As Variant)
Dim department As String
department = Choose(selectedindex + 1, "Depart 1", "Depart 2", "Depart 3")
MsgBox department & " is selected ", vbInformation
End Sub
----------------------------------------------------------------------------------------
Sub ExcelImport()
If department = "Depart 1" Then
Call Macro4Department 1
End If
If department = "Depart 2" Then
Call Macro4Department 2
End If
If department = "Depart 3" Then
Call Macro4Department 3
End If
End Sub
Please note above code is just to demonstrate what I am trying to do.
Thanks for your Help in advance.
Andy