Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Assigning Macro To A Button

Status
Not open for further replies.

gedkins

Mechanical
Joined
May 11, 2001
Messages
45
Location
US
I have an interesting one and if you have a better aproach to the problem I would love to hear it. Here is the problem I am having:

I have a large VBA worksheet that opens a text file, then a template xls workbook (with macros already in it) I then copy all the contents of the text file to the tempate file and then close the original text file. I then proceed to manipulate the newly placed data in the template file. Near the end of the VBA I create a button in the template file then assign a macro to it but the button takes the pathname of the running VBA file. When I save the template file under a new name and the button is clicked its looking for the path back to the original VBA sheet instead of the macro already in the template file. Any ideas how to assign other than using -
Worksheets("Master Item List").Buttons(1).OnAction = "GoMAL"
to avoid the path problem.

Thanks


Guy Edkins
Managing Partner
Delta Group Ltd

gedkins@deltagl.com
 
How about creating the button and it's assigned macro in your template file? (macro could also be in a module)

Keep it in a hidden state, and let your VBA routine unhide and place it accordingly.





Remember...
"If you don't use your head,
your going to have to use your feet."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top