Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


what's mean about this error?

Posted on 1999-08-02
Medium Priority
Last Modified: 2013-11-20
i have a error like:

exampleView.cpp(270) : error C2660: 'Add' : function does not take 0 parameters
E:\Microsoft Visual Studio\MyProjects\example\exampleView.cpp(279) : error C2660: 'Select' : function does not take 0 parameters
E:\Microsoft Visual Studio\MyProjects\example\exampleView.cpp(281) : error C2660: 'GetRange' : function does not take 1 parameters
E:\Microsoft Visual Studio\MyProjects\example\exampleView.cpp(284) : error C2660: 'GetRange' : function does not take 1 parameters
E:\Microsoft Visual Studio\MyProjects\example\exampleView.cpp(287) : error C2660: 'GetRange' : function does not take 1 parameters
E:\Microsoft Visual Studio\MyProjects\example\exampleView.cpp(294) : error C2660: 'GetRange' : function does not take 1 parameters
Error executing cl.exe.

example.exe - 6 error(s), 0 warning(s)

my source code is :
void CExampleView::OnExceloleExecute()
   LPDISPATCH pRange, pWorkbooks;
   CWnd* pWnd = CWnd::FindWindow("XLMAIN", NULL);
   if (pWnd != NULL) {
     TRACE("Excel window found\n");

   VERIFY(pWorkbooks = m_app.GetWorkbooks());

   LPDISPATCH pWorkbook = NULL;
   if (m_workbooks.GetCount() == 0) {
      // Add returns a Workbook pointer, but we
      //  don't have a Workbook class
      pWorkbook = m_workbooks.Add(); // Save the pointer for
                                     //  later release
   LPDISPATCH pWorksheets = m_app.GetWorksheets();
   ASSERT(pWorksheets != NULL);
   LPDISPATCH pWorksheet = m_worksheets.GetItem(COleVariant((short) 1));


   VERIFY(pRange = m_worksheet.GetRange(COleVariant("A1")));

   VERIFY(pRange = m_worksheet.GetRange(COleVariant("A2")));
   VERIFY(pRange = m_worksheet.GetRange(COleVariant("A3")));

   VERIFY(pRange = m_worksheet.GetRange(COleVariant("A3"),

   VERIFY(pRange = m_worksheet.GetRange(COleVariant("A6")));
   m_range[4].SetValue(COleVariant(COleDateTime(1998, 4, 24, 15, 47, 8)));
   // retrieve the stored date and print it as a string
   COleVariant vaTimeDate = m_range[4].GetValue();
   TRACE("returned date type = %d\n", vaTimeDate.vt);
   COleVariant vaTemp;
   vaTemp.ChangeType(VT_BSTR, &vaTimeDate);
   CString str = vaTemp.bstrVal;
   TRACE("date = %s\n", (const char*) str);

   m_range[0].SetValue(COleVariant("test string"));
   COleVariant vaResult0 = m_range[0].GetValue();
   if (vaResult0.vt == VT_BSTR) {
     CString str = vaResult0.bstrVal;
     TRACE("vaResult0 = %s\n", (const char*) str);

   COleVariant vaResult1 = m_range[1].GetValue();
   if (vaResult1.vt == VT_R8) {
     TRACE("vaResult1 = %f\n", vaResult1.dblVal);
   COleVariant vaResult2 = m_range[2].GetValue();
   if (vaResult2.vt == VT_R8) {
     TRACE("vaResult2 = %f\n", vaResult2.dblVal);

   COleVariant vaResult2a = m_range[2].GetFormula();
   if (vaResult2a.vt == VT_BSTR) {
     CString str = vaResult2a.bstrVal;
     TRACE("vaResult2a = %s\n", (const char*) str);
// cleanup  
    if (pWorkbook != NULL) {

void CExampleView::OnUpdateExceloleExecute(CCmdUI* pCmdUI)
   pCmdUI->Enable(m_app.m_lpDispatch != NULL);

void CExampleView::OnExceloleLoad()
{   // if Excel is already running, attach to it, otherwise start it
   CLSID clsid;
   TRACE("Entering CEx25dView::OnExcelLoad\n");
   ::CLSIDFromProgID(L"Excel.Application.8", &clsid); // from registry
   if(::GetActiveObject(clsid, NULL, &pUnk) == S_OK) {
            (void**) &pDisp) == S_OK);
      TRACE(" attach complete\n");
   else {
         if(!m_app.CreateDispatch("Excel.Application.8")) {
                  AfxMessageBox("Excel 97 program not found");
       TRACE(" create complete\n");

void CExampleView::OnUpdateExceloleLoad(CCmdUI* pCmdUI)
   pCmdUI->Enable(m_app.m_lpDispatch == NULL);

my helder file is:
// exampleView.h : interface of the CExampleView class

#if !defined(AFX_EXAMPLEVIEW_H__50D39E1F_48C9_11D3_BC81_00A00CC11E38__INCLUDED_)
#define AFX_EXAMPLEVIEW_H__50D39E1F_48C9_11D3_BC81_00A00CC11E38__INCLUDED_
#include "excel8.h"
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

class CExampleView : public CView

   _Application m_app;
   Range    m_range[5];
   _Worksheet   m_worksheet;
   Workbooks   m_workbooks;
   _Workbook    m_workbook;
   Worksheets   m_worksheets;

protected: // create from serialization only

// Attributes
      CExampleDoc* GetDocument();

// Operations

// Overrides
      // ClassWizard generated virtual function overrides
      virtual void OnDraw(CDC* pDC);  // overridden to draw this view
      virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
      virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
      virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
      virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);

// Implementation
      virtual ~CExampleView();
#ifdef _DEBUG
      virtual void AssertValid() const;
      virtual void Dump(CDumpContext& dc) const;


// Generated message map functions
       afx_msg void OnExceloleExecute();
     afx_msg void OnUpdateExceloleExecute(CCmdUI* pCmdUI);
     afx_msg void OnUpdateExceloleLoad(CCmdUI* pCmdUI);
       afx_msg void OnExceloleLoad();

#ifndef _DEBUG  // debug version in exampleView.cpp
inline CExampleDoc* CExampleView::GetDocument()
   { return (CExampleDoc*)m_pDocument; }


// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_EXAMPLEVIEW_H__50D39E1F_48C9_11D3_BC81_00A00CC11E38__INCLUDED_)

thank you ...

Question by:tewehuang
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment

Accepted Solution

Triskelion earned 150 total points
ID: 1312414
The function you're trying to run requires 2 parameters.

LPDISPATCH GetRange(const VARIANT& Cell1, const VARIANT& Cell2);

VERIFY(pRange = m_worksheet.GetRange(


Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

704 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question