Sim Kuch
asked on
Creating custom ribbon gallery in PowerPoint with VBA - specifying image location
Hi
I am coding a custom gallery which I would like to display all the images in a specific network folder. I have coded the XML fine, but am having trouble with the VBA for the "GetItemImage" element. I have JPGs in my file, but it doesn't seem to be finding the file names, just the folder location.
Please can you tell me where i am going wrong with this. My code is as follows:
Sub PL_image(control As IRibbonControl, Index As Integer, ByRef image)
Dim stpath As String
Dim imgpath As String
Dim imgname As String
stpath = "\\MYPATH\" & imgname 'Path to Picture Library
imgpath = Left(stpath, InStrRev(stpath, ".") - 1)
Set image = LoadPicture(imgpath & ".jpg")
End Sub
I am coding a custom gallery which I would like to display all the images in a specific network folder. I have coded the XML fine, but am having trouble with the VBA for the "GetItemImage" element. I have JPGs in my file, but it doesn't seem to be finding the file names, just the folder location.
Please can you tell me where i am going wrong with this. My code is as follows:
Sub PL_image(control As IRibbonControl, Index As Integer, ByRef image)
Dim stpath As String
Dim imgpath As String
Dim imgname As String
stpath = "\\MYPATH\" & imgname 'Path to Picture Library
imgpath = Left(stpath, InStrRev(stpath, ".") - 1)
Set image = LoadPicture(imgpath & ".jpg")
End Sub
Stand by.....
How do you place the images into the ribbon. Do you just use "Insert" or "Insert and link"?
Forget my last question. I am not very familiar with iRibbonControls.
Here is a reference which MAY HELP IF YOU READ THROUGH THE CODE:
http://gregmaxey.mvps.org/ word_tip_p ages/dynam ic_ribbon_ menu.html
The "callbacks" to objects in the ribbon may be able to get what you are after.
At the moment your code has an empty string for " imgname" and a value is never assigned to it.
You must find a way of getting the filename for an image from the ribbons images.
It is a shame you are using "image" rather than "graphic" since graphics has a property "filename").
I better not say too much more since I may be just saying "rubbish", but perhaps the link I have supplied might lead you somewhere.
If I discover anything else I will get back to you. Let me know of any developments.
Cheers
Chris (Melbourne-Australia)
Here is a reference which MAY HELP IF YOU READ THROUGH THE CODE:
http://gregmaxey.mvps.org/
The "callbacks" to objects in the ribbon may be able to get what you are after.
At the moment your code has an empty string for " imgname" and a value is never assigned to it.
You must find a way of getting the filename for an image from the ribbons images.
It is a shame you are using "image" rather than "graphic" since graphics has a property "filename").
I better not say too much more since I may be just saying "rubbish", but perhaps the link I have supplied might lead you somewhere.
If I discover anything else I will get back to you. Let me know of any developments.
Cheers
Chris (Melbourne-Australia)
You need to use a dynamicGallery not a DynamicMenu and you need to post your XML
XML should look something like this
<gallery id="mygall" label="NEW" imageMso="HappyFace" size="large" onAction="runGall" getItemHeight="getH" getItemWidth="getW"
columns="5" rows="4" getItemCount="getCount" getItemImage="getimage" getItemID="getID" />
GetItemImage does not exist it's getItemImage (case is vital in XML)
XML should look something like this
<gallery id="mygall" label="NEW" imageMso="HappyFace" size="large" onAction="runGall" getItemHeight="getH" getItemWidth="getW"
columns="5" rows="4" getItemCount="getCount" getItemImage="getimage" getItemID="getID" />
GetItemImage does not exist it's getItemImage (case is vital in XML)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Pretty sure it will always be slow on a network.
ASKER
This solution works, but it is very slow. This might always be the case when pulling pictures from a network though - I'm not sure. It's not really a viable solution for use in a corporate tool though, so I have downgraded it.