macro button initiation

N

NewToVB

I'm using visual studio, writing in visual basic (it's basically the same
thing as VBA) and I'm opening up an excel sheet that has a button in it with
a macro assigned to the button. I need to to initiate the button click even
from my code after I've opened up the excel sheet. Any ideas on how to do
this?
 
G

Gary''s Student

If the button macro is something like:

Sub Button1_Click()
Range("D6").Select
ActiveCell.FormulaR1C1 = "1"
Range("D7").Select
End Sub

then your code could:

Application.Run "Book1!Button1_Click"
 
N

NewToVB

Perfect! Thanks a billion!

Gary''s Student said:
If the button macro is something like:

Sub Button1_Click()
Range("D6").Select
ActiveCell.FormulaR1C1 = "1"
Range("D7").Select
End Sub

then your code could:

Application.Run "Book1!Button1_Click"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top