A family of Microsoft relational database management systems designed for ease of use.
The likely issue is that CreateObject("Excel.Application") starts a separate Excel instance, and that instance does not necessarily load the Analysis ToolPak VBA add-in the same way as Excel started normally from the taskbar. Seeing the ToolPak enabled in Excel Options does not guarantee that ATPVBAEN.XLAM is loaded in your automation instance.
Try loading the VBA add-in before calling Regress:
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
Dim ai As Object
For Each ai In objExcel.AddIns
If InStr(1, ai.Name, "Analysis ToolPak - VBA", vbTextCompare) > 0 Then
ai.Installed = True
Exit For
End If
Next
Then use your existing call:
objExcel.Run "ATPVBAEN.XLAM!Regress", _
objSheet.Range(rng_y), objSheet.Range(rng_x), _
objSheet.Range(rng_reg_out), True, True, 1, 0.95, _
True, True, False, False, False
Also verify that objSheet was created from the same objExcel instance. Do not use the full filesystem path to ATPVBAEN.XLAM; that can trigger Excel's security restrictions.
The key difference is that Excel launched from the taskbar goes through the normal Excel startup process, while CreateObject creates a fresh automation instance with its own add-in state.
If the above response helps answer your question, remember to "Accept Answer" so that others in the community facing similar issues can easily find the solution. Your contribution is highly appreciated.
hth
Marcin