LabWindows/CVI

Showing results for 
Search instead for 
Did you mean: 
Reply

LabWindows/CVI Tips 'n Tricks

Re: Read Write Data from Excel sheet.

Hi,

 

Why cannot read out the string type data from the worksheet? I have one row and 5 columns in a excel sheet, my code is like follows:

 

func()

{

    char cellStr[1][500];

    ...

 

 

    Excel_ActiveApp(NULL, 1, LOCALE_NEUTRAL, 0, &excelAppHandle);

    Excel_GetProperty(excelAppHandle, NULL, Excel_AppWorkbooks, CAVT_OBJHANDLE, &excelWorkbooksHandle);

    Excel_SetProperty (excelAppHandle, NULL, Excel_AppVisible, CAVT_BOOL, VFALSE);

    Excel_WorkbooksOpen(excelWorkbooksHandle, NULL, filePath, CA_DEFAULT_VAL,
                                             CA_DEFAULT_VAL, CA_DEFAULT_VAL,
                                             CA_DEFAULT_VAL, CA_DEFAULT_VAL,
                                             CA_DEFAULT_VAL, CA_DEFAULT_VAL,
                                             CA_DEFAULT_VAL, CA_DEFAULT_VAL,
                                             CA_DEFAULT_VAL, CA_DEFAULT_VAL,
                                             CA_DEFAULT_VAL, &excelWorkbookHandle);   

  Excel_GetProperty(excelAppHandle, NULL, Excel_AppSheets, CAVT_OBJHANDLE, &excelSheetsHandle);

  Excel_SheetsItem(excelSheetsHandle, NULL, CA_VariantInt(sheetNum), &excelWorksheetHandle); /* sheetNum equals 1, the first worksheet*/

  Excel_WorksheetActivate(excelWorksheetHandle, NULL);

 ExcelRpt_ReadData(excelWorksheetHandle, "A2:E2", ExRConst_dataString, cellStr[0]);

...

}

 

After excuating the code, cellStr has a  irrecognizable info. please advise how to get the right string value from the excel's cell.

 

thanks.

 

David

 

0 Kudos
Reply
0 Kudos

Re: Read Write Data from Excel sheet.

Hi David,

you can find very useful informations into this post from Mert.

 

 

As an additional suggestion, please consider that this thread is not intended for normal question/answer.

You should create a new thread for new questions like this one: you gain better visibility (besides the fact that you are forced to pass by a search in the forum, which in this case would have indeed returned the thread I am pointing you to Smiley Wink )



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Zone Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Reply
0 Kudos