+ Reply to Thread
Results 1 to 5 of 5

VBA: Assign macro to a button on a toolbar

  1. #1
    Registered User
    Join Date
    07-14-2010
    Location
    Limington, Maine
    MS-Off Ver
    Excel 2003
    Posts
    16

    Question VBA: Assign macro to a button on a toolbar

    How does one do this?

    I only ask because I have a macro that will only execute if the template is located in a certain directory. If I move it, I have to reassign the macro.

    I was hoping there would be a way, preferably through VBA, to assign this macro dynamically.

    Thanks,
    meherts

  2. #2
    Registered User
    Join Date
    07-14-2010
    Location
    Limington, Maine
    MS-Off Ver
    Excel 2003
    Posts
    16

    Re: VBA: Assign macro to a button on a toolbar

    Well, I came up with a solution. If anyone has a better solution, feel free to post it!
    Please Login or Register  to view this content.
    Regards,
    meherts
    Last edited by romperstomper; 09-02-2010 at 04:19 PM. Reason: tags

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

    Re: VBA: Assign macro to a button on a toolbar

    In the Tools -> Options under "Quick Access Toolbar"

    I have a dropdown that shows my Macros. I can add any of my module macors to the QAT.

    I don't know where to find this in Excel 2003. Any help here?

  4. #4
    Registered User
    Join Date
    07-14-2010
    Location
    Limington, Maine
    MS-Off Ver
    Excel 2003
    Posts
    16

    Re: VBA: Assign macro to a button on a toolbar

    @MarvinP

    I wanted to avoid having to manually set the macros, which the code I provided enabled me to do. As for your problem, it'll probably stand a better chance if you started a separate thread. Regardless, good luck!

    Regards,
    meherts

  5. #5
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: VBA: Assign macro to a button on a toolbar

    Safer to use:
    Please Login or Register  to view this content.
    in case the workbook name has spaces in it.
    Remember what the dormouse said
    Feed your head

+ 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