11-11-2009, 03:25 AM
You still need to set your object. It's a variant type by default which will not have a .Cells method.
Code:
Function WriteExcelSht (excelObjIn)
On Error Resume Next
Dim excelObj
[color=#FF4500]Set excelObj = CreateObject("Excel.Application")[/color]
excelObj = excelObjIn
MsgBox "In WriteExcelSht, excelObjIn is: " & excelObjIn & " and excelObj (the function version) is: " & excelObj