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

x
?
Solved

what's mean about this error?

Posted on 1999-08-02
1
Medium Priority
?
273 Views
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");
     pWnd->ShowWindow(SW_SHOWNORMAL);
     pWnd->UpdateWindow();
     pWnd->BringWindowToTop();
   }

   m_app.SetSheetsInNewWorkbook(1);
   
   VERIFY(pWorkbooks = m_app.GetWorkbooks());
   m_workbooks.AttachDispatch(pWorkbooks);

   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);
   m_worksheets.AttachDispatch(pWorksheets);
   LPDISPATCH pWorksheet = m_worksheets.GetItem(COleVariant((short) 1));

   m_worksheet.AttachDispatch(pWorksheet);
   m_worksheet.Select();

   VERIFY(pRange = m_worksheet.GetRange(COleVariant("A1")));
   m_range[0].AttachDispatch(pRange);

   VERIFY(pRange = m_worksheet.GetRange(COleVariant("A2")));
   m_range[1].AttachDispatch(pRange);
   
   VERIFY(pRange = m_worksheet.GetRange(COleVariant("A3")));
   m_range[2].AttachDispatch(pRange);

   VERIFY(pRange = m_worksheet.GetRange(COleVariant("A3"),
         COleVariant("C5")));
   m_range[3].AttachDispatch(pRange);

   VERIFY(pRange = m_worksheet.GetRange(COleVariant("A6")));
   m_range[4].AttachDispatch(pRange);
   
   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);
   }

   m_range[1].SetValue(COleVariant(3.14159));
   
   COleVariant vaResult1 = m_range[1].GetValue();
   if (vaResult1.vt == VT_R8) {
     TRACE("vaResult1 = %f\n", vaResult1.dblVal);
   }
   
   m_range[2].SetFormula(COleVariant("=$A2*2.0"));
   
   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);
   }
   
   m_range[3].FillRight();
   m_range[3].FillDown();
   
// cleanup  
    if (pWorkbook != NULL) {
          pWorkbook->Release();
   }
}

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
   LPDISPATCH pDisp;
   LPUNKNOWN pUnk;
   CLSID clsid;
   TRACE("Entering CEx25dView::OnExcelLoad\n");
   BeginWaitCursor();
   ::CLSIDFromProgID(L"Excel.Application.8", &clsid); // from registry
   if(::GetActiveObject(clsid, NULL, &pUnk) == S_OK) {
      VERIFY(pUnk->QueryInterface(IID_IDispatch,
            (void**) &pDisp) == S_OK);
      m_app.AttachDispatch(pDisp);
      pUnk->Release();
      TRACE(" attach complete\n");
  }
   else {
         if(!m_app.CreateDispatch("Excel.Application.8")) {
                  AfxMessageBox("Excel 97 program not found");
         }
       TRACE(" create complete\n");
   }
   EndWaitCursor();
}

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
{
private:

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

protected: // create from serialization only
      CExampleView();
      DECLARE_DYNCREATE(CExampleView)

// Attributes
public:
      CExampleDoc* GetDocument();

// Operations
public:

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

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

protected:

// Generated message map functions
protected:
      //{{AFX_MSG(CExampleView)
       afx_msg void OnExceloleExecute();
     afx_msg void OnUpdateExceloleExecute(CCmdUI* pCmdUI);
     afx_msg void OnUpdateExceloleLoad(CCmdUI* pCmdUI);
       afx_msg void OnExceloleLoad();
      //}}AFX_MSG
      DECLARE_MESSAGE_MAP()
};

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

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// 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 ...

0
Comment
Question by:tewehuang
[X]
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
 
LVL 6

Accepted Solution

by:
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(
   COleVariant("A1"),
   COleVariant("A1")));


0

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