+ Reply to Thread
Results 1 to 12 of 12

Share a toolbar that calls macro from an add-in

  1. #1
    Registered User
    Join Date
    07-16-2007
    Posts
    43

    Share a toolbar that calls an add-in macro

    I have created some macros that need to be used in several workbooks by more than one users, so I put them in an add-in and gave them instructions on how to get the add-in. I also created a toolbar with buttons calling those macros, attached it to a workbook the users can open, and instructed them to open that workbook once to get the toolbar.

    Both the add-in and the toolbar workbook are on a network drive that my users can access, but when they get the add-in, it gets copied to their own add-in folder.

    Here's my problem:
    When a user tries to click on one of the buttons in the toolbar, the button tries to call the macro using the path that would be valid on my computer to get to my add-in folder. This path includes my user name, so it doesn't go to their own add-in folder: it goes to my add-in folder on that computer if I ever logged in on that particular machine, or it goes nowhere.

    When I created the button, I attached the macros by referring to the add-in workbook by name only, without referring to a path, so I don't know why MY path ended up defined on that toolbar.

    How can I go around this? I manually relinked all the buttons for that user, and I can do it for the other users (there aren't that many users nor that many buttons), but I'd rather avoid it: I'll have to re-do it if the toolbar is updated and it just seems like more work than should be necessary.

    I'm also opened to suggestions on a better way to share those macros. They can't be attached to the workbooks because we use new workbooks every year - they're emailed to us by the people who create them and for a variety of reasons, pasting everything into a workbook of our own is not a good option.

    Thanks for any help,

    Brigitte
    Last edited by Brigitte_P; 03-19-2008 at 08:26 AM. Reason: Bumping

  2. #2
    Registered User
    Join Date
    07-16-2007
    Posts
    43

    Bump

    Just Bumping. Anyone has any idea? How do YOU share macros to be used in several workbooks?

    Brigitte

  3. #3
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    It's much better to add your ToolBar within the code, there's many examples this is one I have edited from one of my existing workbooks.

    Place this in a Standard Module, I have named the module mToolBars and it is added to the Data menu.

    Please Login or Register  to view this content.
    This code is important to make sure that the ToolBar is loaded correctly & unloaded when not needed.
    Please Login or Register  to view this content.
    Last edited by royUK; 03-19-2008 at 08:47 AM.
    Hope that helps.

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

    Free DataBaseForm example

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Here's an example that adds it's own Toolbar
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    07-16-2007
    Posts
    43
    Thanks for the reply, I'll try that!

    Brigitte

  6. #6
    Valued Forum Contributor Macdave_19's Avatar
    Join Date
    03-14-2007
    Location
    Birmingham, England
    MS-Off Ver
    12.0
    Posts
    808

    You Could Try

    try changing the Username part of the file location by adapting this code

    Please Login or Register  to view this content.
    Something Like "C:\Documents and Settings\........" & strName

    P.s. code thanks to ROYUK (Legend)

    HTH
    Mr MaGoo
    Magoo.Inc MMVII

    If i've helped please add to my Rep by Clicking on the Blue Scales in the top right hand corner of the post

  7. #7
    Registered User
    Join Date
    07-16-2007
    Posts
    43
    Thank you for the reply!

  8. #8
    Registered User
    Join Date
    04-21-2008
    Posts
    4

    Similar Problem.... Perhaps

    Hi Guys,

    I have a bunch of macros that were created for charting/graphing. All of the macros work fine and I have them linked to a personal toolbar. I wanted to share the macros with some colleagues and understand that creating an add-in is the best way to do that. Someone pointed me to some code on the Contextures website (http://www.contextures.com/xlToolbar02.html). I don't know anything about coding and was only able to properly link two macros to the toolbars.

    This may seem really naive, but can anyone help explain how I would add the names of my other macros to the toolbar and have them show up? I have already added all the macro subroutines to the module as suggested, but can't seem to figure out how to get the 10-12 other macros onto the Toolbar.

    Thanks!


    Please Login or Register  to view this content.
    '===========================================
    Please Login or Register  to view this content.
    '===========================================
    Please Login or Register  to view this content.
    '===========================================
    Please Login or Register  to view this content.
    Last edited by VBA Noob; 04-21-2008 at 02:19 PM.

  9. #9
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320
    wrap code quickly or the mods will be after you

  10. #10
    Registered User
    Join Date
    04-21-2008
    Posts
    4

    How do I wrap code....

    Oh sorry about that. How do I wrap code?

  11. #11
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320
    [code.] code here [/code.]
    but without . after word code

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

    You should start your own question & post a link to this one if relevant

+ 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