Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • 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
May 11, 2001
45
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
 
Replies continue below

Recommended for you

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