0

I have a created a macro script by recording in excel. Now I need to run this macro script in newly opened excel via QTP (Vb script) . Can anyone suggest me , what call function can be used in qtp to run this macro script in excel? my macro script is

Sub csi()
    ' csi Macro
    ' Keyboard Shortcut: Ctrl+c
    ActiveCell.FormulaR1C1 = "test test test "
    Range("B1").Select
End Sub
AutomatedChaos
  • 7,267
  • 2
  • 27
  • 47
Visitjaga
  • 45
  • 1
  • 5
  • 9

1 Answers1

0

As explained as an answer to a similar question it is not very difficult:

Set objExcel = CreateObject("Excel.Application")
objExcel.Application.Run "test.xls!csi"

or

objExcel.Application.Run "test.xls!sheet1.csi"

Depending if the macro resides in a module or in a sheet.

Community
  • 1
  • 1
AutomatedChaos
  • 7,267
  • 2
  • 27
  • 47
  • I think you can just add them as parameters in the `Run` call: `objExcel.Application.Run "test.xls!csi", "Hello World!", 42` as explained for [Visual Basic](http://support.microsoft.com/kb/153307/en-us). – AutomatedChaos Oct 01 '13 at 06:04