Hey guys,

Im having trouble with a piece of code. From MSDN's site it looks like it should work - plus I made a macro in excel and they're almost identical.

Code:
        Dim rng As Excel.Range = xlSheet.Range("D65536").End(Excel.XlDirection.xlUp)
        xlSheet.ListObjects.Add(Excel.XlSourceType.xlSourceRange, xlSheet.Range("A2:D" & rng.Address.ToString), , Excel.XlYesNoGuess.xlYes).Name = "Table1"
        xlSheet.Range("Table1[#All]").Select()
        xlSheet.ListObjects("Table1").TableStyle = "Table Style 2"

It's getting hung up on the listobjects.add line and it's just throwing an unhandled exception error.

Any help is always appreciated. Thanks Guys.

Zach