×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Assigning Macro To A Button

Assigning Macro To A Button

Assigning Macro To A Button

(OP)
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
www.deltagl.com

RE: Assigning Macro To A Button

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."

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources