LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Trying to launch excel2007 using activeX error!!

I am trying to launch excel2007 using activeX and I receive the following error:

Undefined symbol '_Excel_NewApp@20' referenced in "excel.c".

 

Here is what I did:

 

 ///excel.c

#include <cvirte.h>  
#include <userint.h>
#include <cviauto.h>
#include <utility.h>
#include <ansi_c.h>

#include "excel.h"
#include "excel2000.h"


static int panelHandle;
static HRESULT status;

static void InitVariables(void);

static int appVisible = 1;
static int excelLaunched = 0;

int PANEL_VISIBILITY;

static ExcelObj_App   ExcelAppHandle = 0;      


int main (int argc, char *argv[])
{
 if (InitCVIRTE (0, argv, 0) == 0)
  return -1; /* out of memory */
 
  CA_InitActiveXThreadStyleForCurrentThread (0, COINIT_APARTMENTTHREADED);
 
 if ((panelHandle = LoadPanel (0, "excel.uir", PANEL)) < 0)
  return -1;
 
 InitVariables();
 
 DisplayPanel (panelHandle);
 RunUserInterface ();
 DiscardPanel (panelHandle);
 return 0;
}

static void InitVariables(void)
{
    // Demo path and filename
    GetCtrlVal (panelHandle, PANEL_VISIBILITY, &appVisible);
   
    return;   
}   


int CVICALLBACK runExcel (int panel, int control, int event,
  void *callbackData, int eventData1, int eventData2)
{
 HRESULT error = 0;
 
 switch (event)
 {
  case EVENT_COMMIT:
    SetWaitCursor (1);
    error = Excel_NewApp (NULL, 1, LOCALE_NEUTRAL, 0, &ExcelAppHandle);
    SetWaitCursor (0);
    if (error<0)
     MessagePopup ("Error", "An error occurred trying to launch Excel !!!");
    MakeApplicationActive ();
    excelLaunched = 1;   
    printf("ai pornit excel");
   break;
 }
 return 0;
}

 

The file excel2000.h is the one from the examples National Instruments\CVI2009\samples\activex\excel and here is defined among others:

HRESULT CVIFUNC Excel_NewApp (const char *server, int supportMultithreading,  LCID locale, int reserved, CAObjHandle *objectHandle);

 

Please help!

 

0 Kudos
Message 1 of 2
(3,599 Views)

Hello Annees,

 

Thanks for posting on National Instruments Forum. 

 

Try to recompile your instrument driver you're using to communicate with MS Excel:

Tools>>Create ActiveX controller then choose Excel Server.

    Benjamin R.


Senior LabVIEW Developer @Neosoft


0 Kudos
Message 2 of 2
(3,573 Views)