So, I'm trying to use the Linest function from Excel and I'm trying to implement it into my code. After trying many different ways, this is what I've currently done.

First, I added the Excel Interop to my project resources.

Then I tried this code:

Code:
Imports Microsoft.Office.Interop.Excel

Dim xl As Microsoft.Office.Interop.Excel.Application
Results = xl.WorksheetFunction.LinEst({1,2,3,4}, {5,6,7,8})
I get the following error:

Object reference not set to an instance of an object.
I changed it so I was setting xl as a NEW application instance with the code below:

Code:
Imports Microsoft.Office.Interop.Excel

Dim xl As New Microsoft.Office.Interop.Excel.Application
Results = xl.WorksheetFunction.LinEst({1,2,3,4}, {5,6,7,8})
I then got the following error:

Unable to cast object of type 'System.Object[*]' to type 'System.Object[]'.
I've tried many variations but, sadly, this is as close as I seem to be able to get (I imagine it's probably a pretty simple mistake of creating the correct instances and calling them correctly but, for the life of me, I can't seem to find out where to go from here so I figured I'd check with the experts. But I don't have the money for that so I came to you guys instead.

Any help you can give me would be GREATLY appreciated. Thanks!