Running an excel macro from within VB
Hi all,
I need to run a silly little macro from a command button in VB.
This is the macro from excel:
Code:
Sub Macro1()
'
' Macro1 Macro
' Macro recorded 21/01/2002 by MAGrosoft
'
' Keyboard Shortcut: Ctrl+q
'
Range("A1:A6").Select
Selection.Copy
Workbooks.Open Filename:="C:\My Documents\Book2.xls"
Range("A1").Select
ActiveSheet.Paste
Range("C5").Select
End Sub
its just a cut and paste thingy.
what I want is to be able to call that macro from VB
Any suggestions as to how I do that?
could I dim variabvles in this macro (VBA) so that I can change the selections and filenames, and then pass the parameters from VB across to the VBA macro?
Thanks in advance