LIB FSC Excel Methode .cells() is not running

 When I want to use LIB FSC with Excels .Cells Methode I get an error. Here a sample(worksheet opject is EXCEL Aplication Worksheet) The .Range Methode is running well, but why is .Cells not running? Is this a known BUG? This runs:


  1.017  MATH         cell="B4"

  1.018  LIB          COM Cell = xlWorkSheet.Range[cell];

  1.019  LIB          cellValue = Cell.Value;

 This is not running:

  1.020  LIB          COM Cell = xlWorkSheet.Cells[2,4];

  1.021  LIB          cellValue = Cell.Value;

 I need this to run to all columns of an sheetHere is the Error Message from editor debug window - The runtime closed here hard, without a n error message:

ERROR: System.NullReferenceException: Object reference not set to an instance of an object.

   at Fluke.Calibration.Metcal.Fsc.LibFsc.LibPropRun(String cmd)

   at Fluke.Calibration.Metcal.Fsc.LibFsc.LibRun(String& objName, Object& objValue, String line)

   at ?A0xdff7f4d0.lib(SByte* line, Boolean check_only)

   at lib_r(block* blk, node* node)

   at rdcall(block* blk, proc** pproc)

   at run(block* blk, proc** pproc)

   at ?A0xed064a14.tr_run()

   at tr_handleStep()

   at Fluke.Metcal.Editor.Project.TestRunManager.TestRunStep()

   at Fluke.Metcal.Editor.Project.TestRunManager.StartTestRun(McProjectNode project, String file, Boolean restart)

 

Groups:

Comments

1376599284

I'm not sure what your trying

I'm not sure what your trying to achieve here...But I wrote this for a client once to give them a basic understanding of how to read and write to Excel via MET/CAL

 

# Launch excel and make it visible

  1.001  LIB          COM xlApp = "Excel.Application";

  1.002  LIB          xlApp.Visible = True;


# Store the path to the Excel file.

# Here I have made a Excel file on my desk top called "Test.xls"

  1.003  MATH         xlFile = "C:\\Users\\CPS Demo\\Desktop\\Test.xls"


# Open workbook.

  1.004  LIB          COM xlWB = xlApp.Workbooks;

  1.005  LIB          xlWB.Open(xlFile);


# Select worksheet. By default the first one is "Sheet1"

  1.005  LIB          COM xlWS = xlApp.Worksheets["Sheet1"];

  1.006  LIB          xlWS.Select();


# Here it will select cell "B2" and put whatever is in "MEM into it

  1.007  MATH         MEM = 12.345

  1.008  LIB          COM selectedCell = xlApp.Range["B2"];

  1.009  LIB          selectedCell.Select();

  1.010  LIB          selectedCell.FormulaR1C1 = [MEM];


# Here it will grab whats in cell "C2"

# And put it into a string register called "@FromExcel"

# Make sure there is a value there or it will wig out..

  1.011  LIB          COM T1 = xlApp.Range["C2"];

  1.012  LIB          @FromExcel = T1.Value2;


# As you can see it can be adjusted to suit your needs

# This a basic overview and a starting point...

# You should have that file opened now with the updated data.
1433150521

I do dealing a lot with the

I do dealing a lot with the VBA commands, this is not the problem. My procedure below is reading complete excel sheet in an structure of array. So the table will inserted in this struct, line by line. I have get the error gefore, as I was using .CELLS methode unstead of .Range, but seems .cells was not the problem for the crash. The issue occures, if I get a NULL value back from methode. The editor does not report the NULL, it crashed. But I have tested, it is no problem by .Cells, also when I use.Range, I get this crash. How can I handle NULL values correct?

1376599284

Good question.....I have had

Good question.....I have had this before too, Sorry I dont have an answer maybe flick an email to softwaresupport@flukecal.com