Solved

Macros set to a control button

Posted on 2000-03-08
6
157 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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

773 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