+ Reply to Thread
Results 1 to 6 of 6

How get to code behind a custom button?

  1. #1
    Registered User
    Join Date
    10-26-2011
    Location
    Durham, NC
    MS-Off Ver
    Excel 2000
    Posts
    5

    How get to code behind a custom button?

    I have a machine running Excel 2000 on WinXP. Every time I open any workbook in Excel there is a customized button that has been added to the Standard toolbar. I need to re-create what this button does in Excel on another machine. I know the button causes the execution of some macros located in various files.

    At first I tried finding a file that tells Excel about the customized button and supplies the code behind the button. I searched Excel.xlb and Personal.xls and I can find no macros for the buttons. There is nothing else in the XLSTART folder. I searched the c: drive for .xlt, .xltm, .xltx files and found none.

    When I look at the macros in a fresh workbook that has this button there are no macros and no VB code. How can I get to the code that executes when the button is clicked?

    Thanks.
    Last edited by vbguy391; 10-28-2011 at 01:14 AM.

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,447

    Re: How get to code behind a custom button?

    Hi vbguy391,

    Have you looked at "Customize Ribbon" posibilities?
    The 2007 dialogs look like this http://word.mvps.org/FAQs/Customizat...mizeRibbon.htm
    I have no idea how they did it in 2000.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Forum Expert
    Join Date
    03-31-2009
    Location
    Barstow, Ca
    MS-Off Ver
    Excel 2002 & 2007
    Posts
    2,164

    Re: How get to code behind a custom button?

    The button was probably created manually, so you may never find the code that created it. It wasn't created as a temporary button, so it's permanent no matter what workbook you open it will be there.

    To get at the code:
    1) Right mouse click anywhere in the menus and select "Customize" (at the bottom).
    2) Right mouse click on the button and select "Assign Macro" (at the bottom).
    There's the name of the macro it runs.
    Foxguy

    Remember to mark your questions [Solved] and rate the answer(s)
    Forum Rules are Here

  4. #4
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,447

    Re: How get to code behind a custom button?

    If the custom button runs a function that is built into Excel but simply not on the ribbon you will not be able to see the code. All the Excel built-in functions are in C or C+ and not viewable using VBA.

  5. #5
    Registered User
    Join Date
    10-26-2011
    Location
    Durham, NC
    MS-Off Ver
    Excel 2000
    Posts
    5

    Re: How get to code behind a custom button?

    Foxguy,

    Thanks a lot--I see the macro where you said it would be and that solves my problem.

    Just so I understand how this happens: If the button was created manually, how does the button get put into every new workbook when Excel runs? Did the button get created manually in some kind of template file?

  6. #6
    Forum Expert
    Join Date
    03-31-2009
    Location
    Barstow, Ca
    MS-Off Ver
    Excel 2002 & 2007
    Posts
    2,164

    Re: How get to code behind a custom button?

    You can create you own buttons.
    1) Right mouse click in the menus and select "Customize".
    2) At the bottom of the left window select "Macros".
    3) Select "Custom Button" with your left mouse button and drag it to the position in the menu where you want it and drop it.
    4) Right mouse click the new button and select "Name", and type in the text you want the button to have.
    5) Select "Assign Macro" and point to the sub you want it to run, or type in the name of a sub if it's not visible.

    It is now permanent and will show up in every workbook.

    To delete or move a button:
    1) Right mouse click "Customize".
    2) Select the button with left mouse button and drag it:
    A) onto the Customize window to delete it.
    B) anywhere else in the menus to relocate it.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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