Hi,
Maybe you can try to use the string as parameter, which will be the worksheet name, and then you can define a worksheet with this worksheet name string. For example (in Origin 7):
// get worksheet by name
void get_worksheet_by_name(string strName)
{
Worksheet wks(strName); // define worksheet by name string
if(!wks.IsValid()) // if the worksheet is not valid
{
out_str("not a valid worksheet");
return;
}
out_str("do something with the worksheet here");
}
// loop all worksheet page in the project, so to get worksheet by calling get_worksheet_by_name
void loop_worksheets()
{
for(int index=0; ; index++)
{
WorksheetPage pg = Project.WorksheetPages(index); // get the worksheet page in project by index
if(!pg.IsValid()) // if page is not valid
{
out_str("not a valid page");
break; // get out of the for loop
}
get_worksheet_by_name(pg.GetName()); // worksheet page and worksheet share the same name in Origin 7
}
}
Penn