#1
|
|||
|
|||
Need help with custom UI image gallery ribbon
Hello,
Please help... I would like to select one image at a time from the image gallery and insert it on my PowerPoint slide. At the current time, when I select an image from the gallery, it inserts them all. XML Code using Custom UI Editor: Code:
<customUI xmlns="schemas.microsoft.com/office/2006/01/customui"> <ribbon startFromScratch="false"> <tabs> <tab id="BDOeLearningResourcesTab" label="BDO eLearning Resources"> <!--Colour Palette--> <group id="Group1" label="BDO Colour Palette - REFERENCE ONLY!"> <button id="CustomButton1" label="BDO Red" size="large" onAction="bdored" image="bdored"/> <button id="CustomButton2" label="Coral" size="large" onAction="bdocoral" image="bdocoral"/> <button id="CustomButton3" label="Burgundy" size="large" onAction="bdoburgundy" image="bdoburgundy"/> <button id="CustomButton4" label="Teal" size="large" onAction="bdoteal" image="bdoteal"/> <button id="CustomButton5" label="Teal 40%" size="large" onAction="bdoteal40" image="bdoteal40"/> <button id="CustomButton6" label="Grey" size="large" onAction="bdogrey" image="bdogrey" /> <button id="CustomButton7" label="Grey 40%" size="large" onAction="bdogrey40" image="bdogrey40"/> <button id="CustomButton8" label="Yellow" size="large" onAction="bdoyellow" image="bdoyellow"/> <button id="CustomButton9" label="Yellow 40%" size="large" onAction="bdoyellow40" image="bdoyellow40"/> <button id="CustomButton10" label="Blue" size="large" onAction="bdoblue" image="bdoblue"/> <button id="CustomButton11" label="Blue 40%" size="large" onAction="bdoblue40" image="bdoblue40"/> </group> <!--Gallery--> <group id="Group2" label="Photo Gallery"> <gallery id="Gallery1" label="BDO Authorized Images" imageMso="HeaderFooterPictureInsert" onAction="ClickImage" columns="5" rows="3" itemWidth="100" showItemLabel="false" itemHeight="100" size="large"> <item id="pic1" image="array_of_tools" label="Array of Tools"/> <item id="pic2" image="caliper" label="Caliper"/> <item id="pic3" image="chain_with_red_link" label="Picture 3"/> <item id="pic4" image="china_wall" label="Picture 4"/> <item id="pic5" image="circle_of_arms" label="Picture 5"/> <item id="pic6" image="coins" label="Picture 6"/> <item id="pic7" image="crossing_escalators" label="Picture 1"/> <item id="pic8" image="elephants" label="Picture 2"/> <item id="pic9" image="glass_roofed_building" label="Picture 3"/> <item id="pic10" image="globe_with_yellow_helmet" label="Picture 4"/> <item id="pic11" image="globes" label="Picture 5"/> <item id="pic12" image="guages" label="Picture 6"/> <item id="pic13" image="jumping_helmets" label="Picture 1"/> <item id="pic14" image="laptop_and_newspaper" label="Picture 2"/> <item id="pic15" image="laptop_with_USB_cable" label="Picture 3"/> <item id="pic16" image="laying_paving_stones" label="Picture 4"/> <item id="pic17" image="lion_door_knockers" label="Picture 5"/> <item id="pic18" image="man_and_laptop" label="Picture 6"/> <item id="pic19" image="man_and_woman_discussing" label="Picture 1"/> <item id="pic20" image="man_and_woman_reflected_laptops" label="Picture 2"/> <item id="pic21" image="man_measuring" label="Picture 3"/> <item id="pic22" image="mountains_and_chinese_roof" label="Picture 4"/> <item id="pic23" image="parasols_at_the_beach" label="Picture 5"/> <item id="pic24" image="passing_the_baton" label="Picture 6"/> <item id="pic25" image="people_looking_at_the_sky" label="Picture 6"/> <item id="pic26" image="pulling_two_suitcases" label="Picture 1"/> <item id="pic27" image="red_fans" label="Picture 2"/> <item id="pic28" image="red_reflected_globe" label="Picture 3"/> <item id="pic29" image="red_tower_of_people" label="Picture 4"/> <item id="pic30" image="seven_suited_persons" label="Picture 5"/> <item id="pic31" image="shirts_and_ties" label="Picture 6"/> <item id="pic32" image="stepping_stones" label="Picture 1"/> <item id="pic33" image="suit_with_tools_in_pocket" label="Picture 2"/> <item id="pic34" image="suited_man_with_toolbox" label="Picture 3"/> <item id="pic35" image="tennis_balls" label="Picture 4"/> <item id="pic36" image="three_handheld_globes" label="Picture 5"/> <item id="pic37" image="three_mobile_phones_and_subway" label="Picture 6"/> <item id="pic38" image="three_people_and_globe" label="Picture 1"/> <item id="pic39" image="two_birds_and_skyscrapers" label="Picture 2"/> <item id="pic40" image="two_business_men" label="Picture 3"/> <item id="pic41" image="two_flying_swans" label="Picture 4"/> <item id="pic42" image="two_men_and_plans" label="Picture 5"/> <item id="pic43" image="two_men_reflected" label="Picture 6"/> <item id="pic44" image="two_microscopes" label="Picture 1"/> <item id="pic45" image="two_red_umbrellas" label="Picture 2"/> <item id="pic46" image="two_smiling_men_and_skyscraper" label="Picture 3"/> <item id="pic47" image="two_suited_men_looking" label="Picture 4"/> <item id="pic48" image="two_swimming_swans" label="Picture 5"/> <item id="pic49" image="two_women_and_chairs" label="Picture 6"/> <item id="pic50" image="typing_on_laptop_x2" label="Picture 6"/> <item id="pic51" image="violins" label="Picture 6"/> </gallery> </group> </tab> </tabs> </ribbon> </customUI> VBA Code in PowerPoint Presentation: Code:
Thank you in advance.
Paul |
#2
|
|||
|
|||
In you XML the Schemas should really be
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui"> Why it doesn't work: When you click a gallery the vba is doing exactly what you say .... everything! You need to read the index of the item clicked and use it to select what happens 'Callback for Gallery1 onAction Sub ClickImage(control As IRibbonControl, id As String, index As Integer) Select Case index Case Is = 1 'do this Case Is = 2 'do this 'etc End Select End Sub I would use SlideRange(1) BTW and also add some error checking to make sure a presentation is open and that a slide is selected. |
#3
|
|||
|
|||
Thank you John
Thanks so much John. That's exactly what I was looking for.
One other thing. Instead of a message popup window for the other buttons on the ribbon, I would like these buttons to change the color and font of any selected text. Is this possible? Thank you. |
#4
|
|||
|
|||
Example
'Callback for CustomButton4 onAction Sub bdoteal(control As IRibbonControl) On Error Resume Next '(in case no text selected) With ActiveWindow.Selection.TextRange.Font .Color.RGB = RGB(46, 176, 164) 'any other change here End With ' MsgBox "BDO TEAL - R46, G176, B164" End Sub |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Excel 2007 custom ribbon not showing in Excel 2010 | Paulzak | Excel | 2 | 02-17-2012 06:35 PM |
Custom Tab on the ribbon missing | TechEd | Word | 2 | 09-14-2011 05:08 PM |
Excel 2010 Ribbon look like 2007's Ribbon | esotop | Excel | 0 | 03-22-2011 07:05 PM |
Excel 2010 Custom Ribbon | judicial85 | Excel | 3 | 12-05-2010 07:22 PM |
custom bullet points - stop image resizing | dlee388 | PowerPoint | 1 | 12-29-2009 04:47 PM |