• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 179
  • Last Modified:

Macros set to a control button

What is the code for clicking on a control button in excel that runs a macro?
0
mlouie23
Asked:
mlouie23
  • 3
  • 2
1 Solution
 
vbWayneCommented:
Shell "C:\Program Files\Microsoft Office\Office\WINWORD.EXE /yourmacroname", 1
0
 
mlouie23Author Commented:
Edited text of question.
0
 
mlouie23Author Commented:
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
vbWayneCommented:
 
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
 
andyclapCommented:
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
 
mlouie23Author Commented:
andyclap,

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

Take Care,

mlouie23
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now