Solved

Macros set to a control button

Posted on 2000-03-08
6
161 Views
Last Modified: 2010-05-02
What is the code for clicking on a control button in excel that runs a macro?
0
Comment
Question by:mlouie23
  • 3
  • 2
6 Comments
 
LVL 1

Expert Comment

by:vbWayne
ID: 2597565
Shell "C:\Program Files\Microsoft Office\Office\WINWORD.EXE /yourmacroname", 1
0
 

Author Comment

by:mlouie23
ID: 2597695
Edited text of question.
0
 

Author Comment

by:mlouie23
ID: 2597713
Hi vbWayne,
    Thanks for the help, but I'm sorry, I wasn't specific enough with my question.

     I've got a conrol button on one worksheet, and I want to run a macro within the same file on a different worksheet.  Does the line of code require to have "C:\Program Files\...etc?"
  Is there there a command/code more specific in excel?
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Expert Comment

by:vbWayne
ID: 2598345
 
not sure on that one..I only have bits of code I've collected here and there..the code I gave you opens excel, a file, and runs a macro.


0
 
LVL 6

Accepted Solution

by:
andyclap earned 10 total points
ID: 2598600
You'll need to change the code for the event handler to be public, eg

Public Sub CommandButton1_Click()


then you can use
worksheetname.Commandbutton1_Click

from anywhere within the workbook
0
 

Author Comment

by:mlouie23
ID: 2605314
andyclap,

    Thanks so much for your knowledge!
It helped me a lot.

Take Care,

mlouie23
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question