When I try to access and Excel Sheet I get the following error:
K>> outputFile.Sheets.Item(3)
Error using Interface.000208D7_0000_0000_C000_000000000046/Item
Invoke Error, Dispatch Exception: Invalid index.
I am using the piece of code below, which used to work before:
try app = actxserver('Excel.Application');catcherror('Could not establish a link to Excel');end workbooks = app.Workbooks;outputFile = workbooks.Add;outputFile.Sheets.Add;resultsSheet = outputFile.Sheets.Item(1);exclusionSheet = outputFile.Sheets.Item(2);summarySheet = outputFile.Sheets.Item(3);pfoWgtNanSheet = outputFile.Sheets.Item(4);
Best Answer