Custom word toolbar

Hello,

I have the strangest error and am starting to get frustrated - I have 2 macros, each contains the same code and simply inserts a specific image into a doc (only diff is the image and name). Both macros work sweet individually.
I now need to add these 2 macros to an existing custom toolbar I have - I open this template(Ctoolbar) and then add the 2 macros to the toolbar (Tools - Customize). When I then run the macros from the button, both insert the same image no matter what. I can even create 2 seperate custom toolbars, add a macro to each one and run it and still both deliver the same image (it seems to toggle which image to load sometimes if I delete and try to re-produce)
sbsbatsAsked:
Who is Participating?
 
xtermieCommented:
The problem is that you are using the same macro name, that's causing the confusion.
Name one macro Sub InsertPictureShape()
 and the second one Sub InsertPictureShape2() for example and then attach accordingly to the proper buttons.
0
 
GrahamSkanRetiredCommented:
I can't guess what might cause that. Is it possible to post the template that contains the code and the toolbars?
0
 
xtermieCommented:
We definetely need to see the code and the button in a sample excel file.
Are you sure you have attached a different macro to each button?
Are the images in the same folder?
Please post a sample file
0
Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

 
sbsbatsAuthor Commented:
HI Graham,

Have attached the 3 files - custom toolbar and the 2 macros
Ctoolbar.dot
Inserthbs.dot
Insertsbs.dot
0
 
GrahamSkanRetiredCommented:
I agree with xtermie.

You have posted three templates. One contains the toolbar, while the other two each have an identically named macro (InsertPictureShape) which is the name of the macro that both buttons call. It isn't clear how the templates currently relate to each other, but I suggest that you combine the three into a single template with one of the macros renamed.
0
 
sbsbatsAuthor Commented:
Thanks guys - considered combining into one but was not sure how to assign diff modules within a project to seperate custom buttons
0
 
sbsbatsAuthor Commented:
Thanks guys - thanks for all your help this week Graham
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.