Open Excel, click Developer|Visual Basic (Alt-F11), Insert|Module then paste this code:
Public Function ExcelHandshake(Parameter As String) As String
ExcelHandshake = "Hello " & Parameter
End Function
Note that you must save the file as excel Macro-Enabled Workbook (.xlsm). The remaining code will open the file, call the macro with a parameter and return a result:
Imports Microsoft.Office.Interop
Module Module1
Sub Main()
Dim xlApp = New Excel.Application
Dim xlBook = xlApp.Workbooks.Open("c:\projects\book1.xlsm")
Dim result = xlApp.Run("ExcelHandshake", "My Application")
Console.Write(result)
System.Runtime.InteropServices.Marshal.ReleaseComObject(xlBook)
xlBook = Nothing
xlApp.Quit()
System.Runtime.InteropServices.Marshal.ReleaseComObject(xlApp)
xlApp = Nothing
Console.ReadKey()
End Sub
End Module
You will find more samples here
http://support.microsoft.com/kb/306682[
^]
I hope this is of some help to you.