Consulting

Results 1 to 8 of 8

Thread: Solved: Edit Box on ribbon to save to global variable

  1. #1
    VBAX Expert TrippyTom's Avatar
    Joined
    Jul 2005
    Location
    New York, NY (USA)
    Posts
    556
    Location

    Solved: Edit Box on ribbon to save to global variable

    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
    Office 2010, Windows 7
    goal: to learn the most efficient way

  2. #2
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,724
    Location
    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


    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
    Attached Files Attached Files
    Last edited by Paul_Hossler; 03-29-2013 at 07:52 PM. Reason: Added a small tweak to the attachment code

  3. #3
    VBAX Expert TrippyTom's Avatar
    Joined
    Jul 2005
    Location
    New York, NY (USA)
    Posts
    556
    Location
    Thanks Paul,

    It seems this is exactly what I was looking for. I was so desperate I even purchased an ebook. 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.
    Office 2010, Windows 7
    goal: to learn the most efficient way

  4. #4
    VBAX Expert TrippyTom's Avatar
    Joined
    Jul 2005
    Location
    New York, NY (USA)
    Posts
    556
    Location
    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.
    Office 2010, Windows 7
    goal: to learn the most efficient way

  5. #5
    VBAX Expert TrippyTom's Avatar
    Joined
    Jul 2005
    Location
    New York, NY (USA)
    Posts
    556
    Location
    oh duh... i feel stupid now
    [vba]Public sEditbox As Single[/vba]
    Office 2010, Windows 7
    goal: to learn the most efficient way

  6. #6
    Banned VBAX Newbie
    Joined
    Jan 2014
    Posts
    1
    Location
    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.



  7. #7
    VBAX Regular
    Joined
    Jul 2014
    Posts
    14
    Location
    Thanks Paul, now it is easy

  8. #8

    Solved Edit Box on ribbon to save to global variable

    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?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •