PDA

View Full Version : Solved: Edit Box on ribbon to save to global variable



TrippyTom
03-29-2013, 04:54 AM
Hi gang,

I'm looking for an example to show, in PPT 2010, an example of an editbox control on a ribbon that saves whatever value is typed into it to a global variable, that I can then use in other macros. Is there an easy way to do this?

Currently, I have a button on my UI that opens a userform which does the same thing, but it would be nice to have the editbox directly on the ribbon, if possible.

Thanks for any insight you can provide.
-Tom

Paul_Hossler
03-29-2013, 07:22 PM
You can experiment with this

The attachment has a simple working example also

Just delete the .zip part of the file name since I have never figured out why .pptm files can't be directly uploaded:dunno




customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" onLoad="OnRibbonLoad" >
<ribbon>
<tabs>
<tab id="CustomTab"label="Tom's Tab">
<group id="SampleGroup"label="Tom's Group">
<editBox id="EditBox1"
getText="getMyText"
getLabel="getMyLabel"
onChange="getMyEditBoxChange"
sizeString="WWWWWWWWWWWWWWWWWWW"
/>
<button id="Button1" label="Tom's Button" size="large"imageMso = "HappyFace" onAction="MyButtonMacro" />
<dialogBoxLauncher>
<button id="Launcher1"
screentip="My Launcher"
onAction="MyLauncherMacro" />
</dialogBoxLauncher>
</group>


</tab>
</tabs>
</ribbon>
</customUI>


Paul

TrippyTom
03-29-2013, 08:31 PM
Thanks Paul,

It seems this is exactly what I was looking for. :) I was so desperate I even purchased an ebook (http://www.amazon.com/RibbonX-Customizing-Office-2007-Ribbon/dp/0470191112). It's a great book but I did something wrong and couldn't get my test to work.

At least now I can look at your code and try to see what I did wrong. Thanks so much.

TrippyTom
03-30-2013, 02:16 AM
Hey Paul,
I'm trying to use a single instead of string for my editbox value, but it keeps rounding the number up. For instance, I type 1.5 and it makes it 2. Not sure what's going on. :)

I should point out it's showing it correctly in your example, but I'm not sure if it's seeing it at "text" or an actual "single" value.

TrippyTom
03-30-2013, 02:21 AM
oh duh... i feel stupid now :)
Public sEditbox As Single

armia741
01-27-2014, 03:03 AM
I should point out it's showing it correctly in your example, but I'm not sure if it's seeing it at "text" or an actual "single" value.

fotodj
07-13-2014, 06:43 PM
Thanks Paul, now it is easy

josef
02-08-2015, 05:23 AM
I also have the same problems, where the password does not save and the file will not save on Sharepoint, but on my local hard drive. Any updates to this now that 5 years have passed?