0

Using LIB FSC to export data to excel

I have to been trying to use the LIB FSC to export readings into a validated excel spreadsheet. I have been successful

in retrieving the data and inserting it into the appropriate cell. However I am unable to save the completed workbook with the required filename and location. Actually have can't seem to save the workbook programmatically at all. No matter what changes i make I always get the same error message:

LIB FSC EXCEPTION:

Unable to invoke function/method SaveAs

Exception:  Unknown name. (Exception from HRSULT: 0x80020006

(DISP E UNKNOWNNAME))

 

Any suggestions or assistance will be greatly appreciated.

5 comments

Date Votes
0
Avatar
Michael J.

Hi Jimmy,

I just responded to the open ticket you had with technical support. I believe this issue is related an outdated libraryfsc.xml file or datatypemap.xml file. I've sent some updated ones, so we can keep working the issue in your ticket.

0
Avatar
Jimmy Shipley

Now i'm getting a preceding error caused the procedure to halt message.

 

#Define initial excel file
  1.007  MATH         @file = "M:/OscopeWS/GenericVPA2.xls"
# Define Path for SaveCopyAs method.
  1.015  MATH         @Sfile = "M:/OscopeWS/" & @WO & ".xls"
# Open an instance of Excel and make it visible
  1.018  LIB          COM excel = "Excel.Application";
  1.019  LIB          excel.Visible = True;
# Open a workbook
  1.020  LIB          COM workbook = excel.Workbooks;
  1.021  LIB          workbook.open(@file);
# Save workbook to required filename
  1.024  LIB          workbook.SaveCopyAs(@Sfile);
0
Avatar
Alan Woods

Hi jimmy

 I think your file format is wrong try

MATH @Sfile = "M:\\filepath\\" & $WO & ".XLS"

you need escaped backslashes in the file path

it works for me but the savecopyas still dosn't work

 

0
Avatar
Jimmy Shipley
I got it to work. At least in the metcal test environment. I had to change from
 
workbook.SaveAs(@file);
 
to
 
worksheet.SaveAs(@file)
 
and that seems to have done the trick. I will get the technician to do a runtime test shortly.
0
Avatar
Lars Andersson

... got the same issue, these files "libraryfcs" and/or "datatypemap" can you post them here so I all can get access too?

 

Please sign in to leave a comment.