+ Reply to Thread
Results 1 to 9 of 9

Attaching Standard Excel Command to Button

  1. #1
    Registered User
    Join Date
    01-18-2012
    Location
    Los Angeles USA
    MS-Off Ver
    Excel Office 365
    Posts
    80

    Attaching Standard Excel Command to Button

    I would like to attach a standard Excel command to a form control button. Specifically I want to place two buttons on a worksheet, one would execute the Pivot Table Refresh command and the second would execute the Form command for a Table List. I know these commands are easily available on the right click menu or the Quick Access toolbar, but this still isn't easy enough for the end user. I can't find how I can just attach these commands to a button, thanks.
    Last edited by laguna92651; 01-23-2012 at 04:23 PM.

  2. #2
    Forum Expert OnErrorGoto0's Avatar
    Join Date
    12-30-2011
    Location
    I DO NOT POST HERE ANYMORE
    MS-Off Ver
    I DO NOT POST HERE ANYMORE
    Posts
    1,655

    Re: Attaching Standard Excel Command to Button

    The simplest method is probably to simulate clicking the relevant button
    Please Login or Register  to view this content.
    for example.
    Good luck.

  3. #3
    Registered User
    Join Date
    01-18-2012
    Location
    Los Angeles USA
    MS-Off Ver
    Excel Office 365
    Posts
    80

    Re: Attaching Standard Excel Command to Button

    So I would attach the supplied code to a button? Is there a listing of what the various commands are or is just the name in the tooltip (for example Form command to create new record in a table) or the menu label?

  4. #4
    Forum Expert OnErrorGoto0's Avatar
    Join Date
    12-30-2011
    Location
    I DO NOT POST HERE ANYMORE
    MS-Off Ver
    I DO NOT POST HERE ANYMORE
    Posts
    1,655

    Re: Attaching Standard Excel Command to Button

    Yes.
    If you hover over the item in the QAT customisation dialog, the tooltip is the name you need. There is also a listing in a workbook available via the Ribbon section of Ron de Bruin's site (www.rondebruin.nl)

  5. #5
    Registered User
    Join Date
    01-18-2012
    Location
    Los Angeles USA
    MS-Off Ver
    Excel Office 365
    Posts
    80

    Re: Attaching Standard Excel Command to Button

    I tried the code:

    Please Login or Register  to view this content.
    and got the following error.

    runtime_error.JPG

    I'm trying to refresh a pivot table with the button. Any further thoughts?

  6. #6
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Attaching Standard Excel Command to Button

    Try this to refresh a specific PivotTabel

    Please Login or Register  to view this content.
    To refresh multiple PivotTables

    Please Login or Register  to view this content.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  7. #7
    Forum Expert OnErrorGoto0's Avatar
    Join Date
    12-30-2011
    Location
    I DO NOT POST HERE ANYMORE
    MS-Off Ver
    I DO NOT POST HERE ANYMORE
    Posts
    1,655

    Re: Attaching Standard Excel Command to Button

    Did you have a pivot table selected?

  8. #8
    Registered User
    Join Date
    01-18-2012
    Location
    Los Angeles USA
    MS-Off Ver
    Excel Office 365
    Posts
    80

    Re: Attaching Standard Excel Command to Button

    This code worked great.

    Please Login or Register  to view this content.
    How would I automatically refresh the pivot table whenever I add, edit or delete a record in the source list.

  9. #9
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Attaching Standard Excel Command to Button

    Your post does not comply with Rule 9 of our Forum RULES. If you solve a problem yourself before anyone else has responded, please take a moment to describe your solution, chances are some other member will benefit. And please never edit a thread in which someone else has responded.


    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1