_Workbook wkbk = wkbks.Open("..\\1.xls",var,var,var,var,var,var,var,var,var,var,var,var);
Worksheets wksts = wkbk.GetWorksheets();
_Worksheet wkst = wksts.GetItem(CComVariant(1));
Range rng=wkst.GetCells();
rng = rng.GetRange(COleVariant("a1"), COleVariant("e5000"));rng.Find (const VARIANT& What, const VARIANT& After, const VARIANT& LookIn, 
          const VARIANT& LookAt, const VARIANT& SearchOrder, long SearchDirection, 
          const VARIANT& MatchCase, const VARIANT& MatchByte,
          const VARIANT& MatchControlCharacters, const VARIANT& MatchDiacritics, 
          const VARIANT& MatchKashida, const VARIANT& MatchAlefHamza)我每次查找时,程序都报告参数数目不对或无效参数,那位能告诉我find的参数怎样初始化啊??
在下谢了!!!!!!!!!!!!!着急!!!!!!!!!

解决方案 »

  1.   

    Find(Str, Null, xlFormulas, xlPart, xlByRows, xlNext, False, False);
      

  2.   

    Find
    The Find method enables you to search for text within the range. This method mimics the behavior of the Find and Replace dialog box in Excel. The method uses parameters you pass to it, or, if you do not pass parameters, it uses the values in the Find and Replace dialog box.Find Method parameters include the following:Parameter Type Description 
    What (required) Object The data to find; can be a string or any Excel data type. 
    After Range The range after which you want the search to start (this cell is not included in the search); if you do not specify this cell, the search begins in the upper left corner of the range. 
    LookIn XlFindLookin (xlValue, xlComments, xlFormulas) The type of information to be searched; cannot be combined using the Or operator. 
    LookAt XlLookAt (xlWhole, xlPart) Determines whether the search matches entire cells or partial cells. 
    SearchOrder XlSearchOrder (xlByRows, xlByColumns) Determines the order for the search; xlByRows (the default) causes the search to go across and then down, and xlByColumns causes the search to go down and then across. 
    SearchDirection XlSearchDirection (xlNext, xlPrevious) Determines the direction of the search. 
    MatchCase Boolean Determines whether the search is case-sensitive. 
    MatchByte Boolean Determines whether double-byte characters match only double-byte characters (True) or equivalent single-byte characters (False); only applies if you have double-byte support.
      

  3.   

    rng.Find("apples", NULL,Excel.XlFindLookIn.xlValues, Excel.XlLookAt.xlPart, 
        Excel.XlSearchOrder.xlByRows, Excel.XlSearchDirection.xlNext, False)
    稍微改改就行了
      

  4.   

    大哥们,那些都是再vb中得写法,怎么再vc中调啊???