View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
haiying haiying is offline
external usenet poster
 
Posts: 3
Default cannot get ListObject using C++

Hi there,
I want to show the autofilter button programmatically from C++ application.
However, I cannot get it work yet. Eveen worse, I am not able to get the
ListObject.
I used the following code. Looks like I got the lists correctly, however,
GetCount() always return me zero. and listObj run into an error. I do have
some data in the sheet.
Any suggestion will be highly appreciated.

ListObjects lists;
ListObject listObj;

lists=objSheet.GetListObjects();
int num=lists.GetCount();

/*
for(i=0;i<(int)num;i++)
{
ListObject listObj=lists.GetItem(COleVariant((short)i));
listObj.SetShowAutoFilter(TRUE);
}*/