Forum Discussion

Juls's avatar
Juls
Occasional Contributor
13 years ago

Open Excel worksheets in c# script

Hello,

I would like to define which worksheet should be used next in different tests.

I tried it like this, but it doesn´t work right: 



l_Excel = Sys["OleObject"]("Excel.Application");

l_Excel["Workbooks"]["Open"](\\...)["Worksheets"]("Sheet1")["Active"];

 



It takes the sheet which was last opened in the file, but not the sheet which I´ve defined in the function (sheet1).

Anyone an idea?



Thanks a lot!

Juls