'This runs the macro below
RunMacro
'The RunMacro procedure
Sub RunMacro()
Dim xl
Dim xlBook
Dim sCurPath
'path = CreateObject("Scripting.FileSystemObject").GetAbsolutePathName(".")
Set xl = CreateObject("Excel.application")
Set xlBook = xl.Workbooks.Open("D:\DESKTOP\TEST.xls", 0, True)
Set ws = xlBook.Worksheets("Sheet1")
Row = ws.UsedRange.Rows.Count
ws.Cells(Row + 1, 2).Value = "ABC"
xl.Application.Visible = True
xl.DisplayAlerts = True
xl.Application.run "TEST.xls!Macro1", "HELLO"
xl.ActiveWindow.close
xl.Quit
Set xlBook = Nothing
Set xl = Nothing
End Sub
####
Sub Macro1(Param1 As String)
Range("E9").Select
ActiveCell.FormulaR1C1 = Param1
Range("D9").Select
ActiveCell.FormulaR1C1 = "14"
Range("C9").Select
ActiveCell.FormulaR1C1 = "=SUM(R[-8]C:R[-1]C)"
Range("C10").Select
End Sub
####
1 2 3 4
1 2 3 4
1 2 3 4
1 2 3 4
1 2 3 4
1 2 3 4
1 2 3 4
1 2 3 4
24 1 1 1