Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 04-19-2013, 09:52 AM
pfiggy pfiggy is offline Need help with custom UI image gallery ribbon Windows 7 64bit Need help with custom UI image gallery ribbon Office 2007
Novice
Need help with custom UI image gallery ribbon
 
Join Date: Apr 2013
Posts: 5
pfiggy is on a distinguished road
Default 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:
 

'Callback for CustomButton1 onAction
Sub bdored(control As IRibbonControl) MsgBox "BDO RED - R237, G26, B59" End Sub
'Callback for CustomButton2 onAction Sub bdocoral(control As IRibbonControl) MsgBox "BDO CORAL - R246, G161, B168" End Sub
'Callback for CustomButton3 onAction Sub bdoburgundy(control As IRibbonControl) MsgBox "BDO BURGUNDY - R152, G0, B46" End Sub
'Callback for CustomButton4 onAction Sub bdoteal(control As IRibbonControl) MsgBox "BDO TEAL - R46, G176, B164" End Sub
'Callback for CustomButton5 onAction Sub bdoteal40(control As IRibbonControl) MsgBox "BDO TEAL 40% - R46, G176, B164" End Sub
'Callback for CustomButton6 onAction Sub bdogrey(control As IRibbonControl) MsgBox "BDO GREY - R120, G104, B96" End Sub
'Callback for CustomButton7 onAction Sub bdogrey40(control As IRibbonControl) MsgBox "BDO GREY 40% - R120, G104, B96" End Sub
'Callback for CustomButton8 onAction Sub bdoyellow(control As IRibbonControl) MsgBox "BDO YELLOW - R255, G227, B156" End Sub
'Callback for CustomButton9 onAction Sub bdoyellow40(control As IRibbonControl) MsgBox "BDO YELLOW 40% - R255, G227, B156" End Sub
'Callback for CustomButton10 onAction Sub bdoblue(control As IRibbonControl) MsgBox "BDO BLUE - R34, G64, B154" End Sub
'Callback for CustomButton11 onAction Sub bdoblue40(control As IRibbonControl) MsgBox "BDO RED - R34, G64, B154" End Sub
'Callback for Gallery1 onAction Sub ClickImage(control As IRibbonControl, id As String, index As Integer) ActiveWindow.Selection.SlideRange.Shapes.AddPicture(FileName:="path to my image files\array_of_tools.png", LinkToFile:=msoFalse, SaveWithDocument:=msoTrue, Left:=100, Top:=100).Select ActiveWindow.Selection.SlideRange.Shapes.AddPicture(FileName:="path to my image files\caliper.png", LinkToFile:=msoFalse, SaveWithDocument:=msoTrue, Left:=100, Top:=100).Select ActiveWindow.Selection.SlideRange.Shapes.AddPicture(FileName:="path to my image files\chain_with_red_link.png", LinkToFile:=msoFalse, SaveWithDocument:=msoTrue, Left:=100, Top:=100).Select ActiveWindow.Selection.SlideRange.Shapes.AddPicture(FileName:="path to my image files\china_wall.png", LinkToFile:=msoFalse, SaveWithDocument:=msoTrue, Left:=100, Top:=100).Select ActiveWindow.Selection.SlideRange.Shapes.AddPicture(FileName:="path to my image files\circle_of_arms.png", LinkToFile:=msoFalse, SaveWithDocument:=msoTrue, Left:=100, Top:=100).Select ActiveWindow.Selection.SlideRange.Shapes.AddPicture(FileName:="path to my image files\coins.png", LinkToFile:=msoFalse, SaveWithDocument:=msoTrue, Left:=100, Top:=100).Select ActiveWindow.Selection.SlideRange.Shapes.AddPicture(FileName:="path to my image files\crossing_escalators.png", LinkToFile:=msoFalse, SaveWithDocument:=msoTrue, Left:=100, Top:=100).Select ActiveWindow.Selection.SlideRange.Shapes.AddPicture(FileName:="path to my image files\elephants.png", LinkToFile:=msoFalse, SaveWithDocument:=msoTrue, Left:=100, Top:=100).Select ActiveWindow.Selection.SlideRange.Shapes.AddPicture(FileName:="path to my image files\glass_roofed_building.png", LinkToFile:=msoFalse, SaveWithDocument:=msoTrue, Left:=100, Top:=100).Select ActiveWindow.Selection.SlideRange.Shapes.AddPicture(FileName:="path to my image files\globe_with_yellow_helmet.png", LinkToFile:=msoFalse, SaveWithDocument:=msoTrue, Left:=100, Top:=100).Select ActiveWindow.Selection.SlideRange.Shapes.AddPicture(FileName:="path to my image files\globes.png", LinkToFile:=msoFalse, SaveWithDocument:=msoTrue, Left:=100, Top:=100).Select ActiveWindow.Selection.SlideRange.Shapes.AddPicture(FileName:="path to my image files\guages.png", LinkToFile:=msoFalse, SaveWithDocument:=msoTrue, Left:=100, Top:=100).Select ActiveWindow.Selection.SlideRange.Shapes.AddPicture(FileName:="path to my image files\jumping_helmets.png", LinkToFile:=msoFalse, SaveWithDocument:=msoTrue, Left:=100, Top:=100).Select ActiveWindow.Selection.SlideRange.Shapes.AddPicture(FileName:="path to my image files\laptop_and_newspaper.png", LinkToFile:=msoFalse, SaveWithDocument:=msoTrue, Left:=100, Top:=100).Select ActiveWindow.Selection.SlideRange.Shapes.AddPicture(FileName:="path to my image files\laptop_with_USB_cable.png", LinkToFile:=msoFalse, SaveWithDocument:=msoTrue, Left:=100, Top:=100).Select ActiveWindow.Selection.SlideRange.Shapes.AddPicture(FileName:="path to my image files\laying_paving_stones.png", LinkToFile:=msoFalse, SaveWithDocument:=msoTrue, Left:=100, Top:=100).Select ActiveWindow.Selection.SlideRange.Shapes.AddPicture(FileName:="path to my image files\lion_door_knockers.png", LinkToFile:=msoFalse, SaveWithDocument:=msoTrue, Left:=100, Top:=100).Select ActiveWindow.Selection.SlideRange.Shapes.AddPicture(FileName:="path to my image files\man_and_laptop.png", LinkToFile:=msoFalse, SaveWithDocument:=msoTrue, Left:=100, Top:=100).Select ActiveWindow.Selection.SlideRange.Shapes.AddPicture(FileName:="path to my image files\man_and_woman_discussing.png", LinkToFile:=msoFalse, SaveWithDocument:=msoTrue, Left:=100, Top:=100).Select ActiveWindow.Selection.SlideRange.Shapes.AddPicture(FileName:="path to my image files\man_and_woman_reflected_laptops.png", LinkToFile:=msoFalse, SaveWithDocument:=msoTrue, Left:=100, Top:=100).Select ActiveWindow.Selection.SlideRange.Shapes.AddPicture(FileName:="path to my image files\man_measuring.png", LinkToFile:=msoFalse, SaveWithDocument:=msoTrue, Left:=100, Top:=100).Select ActiveWindow.Selection.SlideRange.Shapes.AddPicture(FileName:="path to my image files\mountains_and_chinese_roof.png", LinkToFile:=msoFalse, SaveWithDocument:=msoTrue, Left:=100, Top:=100).Select ActiveWindow.Selection.SlideRange.Shapes.AddPicture(FileName:="path to my image files\parasols_at_the_beach.png", LinkToFile:=msoFalse, SaveWithDocument:=msoTrue, Left:=100, Top:=100).Select ActiveWindow.Selection.SlideRange.Shapes.AddPicture(FileName:="path to my image files\passing_the_baton.png", LinkToFile:=msoFalse, SaveWithDocument:=msoTrue, Left:=100, Top:=100).Select ActiveWindow.Selection.SlideRange.Shapes.AddPicture(FileName:="path to my image files\people_looking_at_the_sky.png", LinkToFile:=msoFalse, SaveWithDocument:=msoTrue, Left:=100, Top:=100).Select ActiveWindow.Selection.SlideRange.Shapes.AddPicture(FileName:="path to my image files\pulling_two_suitcases.png", LinkToFile:=msoFalse, SaveWithDocument:=msoTrue, Left:=100, Top:=100).Select ActiveWindow.Selection.SlideRange.Shapes.AddPicture(FileName:="path to my image files\red_fans.png", LinkToFile:=msoFalse, SaveWithDocument:=msoTrue, Left:=100, Top:=100).Select ActiveWindow.Selection.SlideRange.Shapes.AddPicture(FileName:="path to my image files\red_reflected_globe.png", LinkToFile:=msoFalse, SaveWithDocument:=msoTrue, Left:=100, Top:=100).Select ActiveWindow.Selection.SlideRange.Shapes.AddPicture(FileName:="path to my image files\red_tower_of_people.png", LinkToFile:=msoFalse, SaveWithDocument:=msoTrue, Left:=100, Top:=100).Select ActiveWindow.Selection.SlideRange.Shapes.AddPicture(FileName:="path to my image files\seven_suited_persons.png", LinkToFile:=msoFalse, SaveWithDocument:=msoTrue, Left:=100, Top:=100).Select ActiveWindow.Selection.SlideRange.Shapes.AddPicture(FileName:="path to my image files\shirts_and_ties.png", LinkToFile:=msoFalse, SaveWithDocument:=msoTrue, Left:=100, Top:=100).Select ActiveWindow.Selection.SlideRange.Shapes.AddPicture(FileName:="path to my image files\stepping_stones.png", LinkToFile:=msoFalse, SaveWithDocument:=msoTrue, Left:=100, Top:=100).Select ActiveWindow.Selection.SlideRange.Shapes.AddPicture(FileName:="path to my image files\suit_with_tools_in_pocket.png", LinkToFile:=msoFalse, SaveWithDocument:=msoTrue, Left:=100, Top:=100).Select ActiveWindow.Selection.SlideRange.Shapes.AddPicture(FileName:="path to my image files\suited_man_with_toolbox.png", LinkToFile:=msoFalse, SaveWithDocument:=msoTrue, Left:=100, Top:=100).Select ActiveWindow.Selection.SlideRange.Shapes.AddPicture(FileName:="path to my image files\tennis_balls.png", LinkToFile:=msoFalse, SaveWithDocument:=msoTrue, Left:=100, Top:=100).Select ActiveWindow.Selection.SlideRange.Shapes.AddPicture(FileName:="path to my image files\three_handheld_globes.png", LinkToFile:=msoFalse, SaveWithDocument:=msoTrue, Left:=100, Top:=100).Select ActiveWindow.Selection.SlideRange.Shapes.AddPicture(FileName:="path to my image files\three_mobile_phones_and_subway.png", LinkToFile:=msoFalse, SaveWithDocument:=msoTrue, Left:=100, Top:=100).Select ActiveWindow.Selection.SlideRange.Shapes.AddPicture(FileName:="path to my image files\three_people_and_globe.png", LinkToFile:=msoFalse, SaveWithDocument:=msoTrue, Left:=100, Top:=100).Select ActiveWindow.Selection.SlideRange.Shapes.AddPicture(FileName:="path to my image files\two_birds_and_skyscrapers.png", LinkToFile:=msoFalse, SaveWithDocument:=msoTrue, Left:=100, Top:=100).Select ActiveWindow.Selection.SlideRange.Shapes.AddPicture(FileName:="path to my image files\two_business_men.png", LinkToFile:=msoFalse, SaveWithDocument:=msoTrue, Left:=100, Top:=100).Select ActiveWindow.Selection.SlideRange.Shapes.AddPicture(FileName:="path to my image files\two_flying_swans.png", LinkToFile:=msoFalse, SaveWithDocument:=msoTrue, Left:=100, Top:=100).Select ActiveWindow.Selection.SlideRange.Shapes.AddPicture(FileName:="path to my image files\two_men_and_plans.png", LinkToFile:=msoFalse, SaveWithDocument:=msoTrue, Left:=100, Top:=100).Select ActiveWindow.Selection.SlideRange.Shapes.AddPicture(FileName:="path to my image files\two_men_reflected.png", LinkToFile:=msoFalse, SaveWithDocument:=msoTrue, Left:=100, Top:=100).Select ActiveWindow.Selection.SlideRange.Shapes.AddPicture(FileName:="path to my image files\two_microscopes.png", LinkToFile:=msoFalse, SaveWithDocument:=msoTrue, Left:=100, Top:=100).Select ActiveWindow.Selection.SlideRange.Shapes.AddPicture(FileName:="path to my image files\two_red_umbrellas.png", LinkToFile:=msoFalse, SaveWithDocument:=msoTrue, Left:=100, Top:=100).Select ActiveWindow.Selection.SlideRange.Shapes.AddPicture(FileName:="path to my image files\two_smiling_men_and_skyscraper.png", LinkToFile:=msoFalse, SaveWithDocument:=msoTrue, Left:=100, Top:=100).Select ActiveWindow.Selection.SlideRange.Shapes.AddPicture(FileName:="path to my image files\two_suited_men_looking.png", LinkToFile:=msoFalse, SaveWithDocument:=msoTrue, Left:=100, Top:=100).Select ActiveWindow.Selection.SlideRange.Shapes.AddPicture(FileName:="path to my image files\two_swimming_swans.png", LinkToFile:=msoFalse, SaveWithDocument:=msoTrue, Left:=100, Top:=100).Select ActiveWindow.Selection.SlideRange.Shapes.AddPicture(FileName:="path to my image files\two_women_and_chairs.png", LinkToFile:=msoFalse, SaveWithDocument:=msoTrue, Left:=100, Top:=100).Select ActiveWindow.Selection.SlideRange.Shapes.AddPicture(FileName:="path to my image files\typing_on_laptop_x2.png", LinkToFile:=msoFalse, SaveWithDocument:=msoTrue, Left:=100, Top:=100).Select ActiveWindow.Selection.SlideRange.Shapes.AddPicture(FileName:="path to my image files\violins.png", LinkToFile:=msoFalse, SaveWithDocument:=msoTrue, Left:=100, Top:=100).Select End Sub
Thank you in advance.
Paul
Reply With Quote
  #2  
Old 04-19-2013, 10:13 AM
JohnWilson JohnWilson is offline Need help with custom UI image gallery ribbon Windows 7 64bit Need help with custom UI image gallery ribbon Office 2010 32bit
Programmer
 
Join Date: Nov 2008
Location: UK
Posts: 1,912
JohnWilson has a spectacular aura aboutJohnWilson has a spectacular aura about
Default

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.
__________________
Microsoft PowerPoint MVP 2007-2023
Free Advanced PowerPoint Tips and Tutorials
Reply With Quote
  #3  
Old 04-21-2013, 09:45 PM
pfiggy pfiggy is offline Need help with custom UI image gallery ribbon Windows 7 64bit Need help with custom UI image gallery ribbon Office 2007
Novice
Need help with custom UI image gallery ribbon
 
Join Date: Apr 2013
Posts: 5
pfiggy is on a distinguished road
Default 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.
Reply With Quote
  #4  
Old 04-28-2013, 07:13 AM
JohnWilson JohnWilson is offline Need help with custom UI image gallery ribbon Windows 7 64bit Need help with custom UI image gallery ribbon Office 2010 32bit
Programmer
 
Join Date: Nov 2008
Location: UK
Posts: 1,912
JohnWilson has a spectacular aura aboutJohnWilson has a spectacular aura about
Default

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
__________________
Microsoft PowerPoint MVP 2007-2023
Free Advanced PowerPoint Tips and Tutorials
Reply With Quote
Reply

Thread Tools
Display Modes


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
Need help with custom UI image gallery ribbon Excel 2010 Custom Ribbon judicial85 Excel 3 12-05-2010 07:22 PM
Need help with custom UI image gallery ribbon custom bullet points - stop image resizing dlee388 PowerPoint 1 12-29-2009 04:47 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:19 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft