fartbagxp Posted November 9, 2009 Report Share Posted November 9, 2009 I have been trying to use ActiveX classes and write to multiple excel sheets. I was able to create a new workbook but it seems like I keep on getting a run-time error... Error 98 occurred at Unknown System Error in ExcelWritingDataToMultipleSheet.vi Possible reason(s): LabVIEW: Incorrect file type. Attempted to read from or write to a file of a type incompatible with the operation. This normally is a user data file. I don't really understand the concept of variant types. If somebody can point out how to fix this, that would be great... Thank you. ExcelWritingDataToMultipleSheet.vi Quote Link to comment
FrankB Posted November 10, 2009 Report Share Posted November 10, 2009 Hi, the error occures because of using the wrong ActiveX class constant at type input of the 'Variant To Data' primitive. Select the class 'Excel._Worksheet' and the conversion will work properly. Now your example will write values to cell A2 of the worksheet with index 2. If you want to write more than 1 value, you have two possibilities: - explicitly set '_Worksheet.Range' to a single cell (Cell1 input) which you want to overwrite with the next scalar value. This for each of your values. Advantage: values can be spread all over the sheet. Disadvantage: slower. - set both inputs, Cell1 and Cell2, of '_Worksheet.Range' to a reasonable value, depending on the amount of data within your data array, to write all the data at once to your sheet. Advantage: faster. Disadvantage: values are written on block. Regards, Frank 1 Quote Link to comment
ooth Posted November 10, 2009 Report Share Posted November 10, 2009 Hi, Working with Excel ActiveX can be frustrating. I made some changes to your VI and it works now. Let me know if you have questions about the comments I added. PS. Frank be me to the reply, but the info he says is all correct. Good luck. ExcelWritingDataToMultipleSheet.vi 1 Quote Link to comment
Popular Post thols Posted November 10, 2009 Popular Post Report Share Posted November 10, 2009 I have on different projects had to use Excel ActiveX. My experience is: avoid it, you will get into trouble. The troubles are not unmanageable but frustrating, especially if you need to support different versions of Excel, different languages/localisations, and even different installation options. Maybe you know that you need to use ActiveX, but if you do not, consider using for example a tab-delimited text file, which Excel can read. 3 Quote Link to comment
PaulG. Posted November 10, 2009 Report Share Posted November 10, 2009 I have on different projects had to use Excel ActiveX. My experience is: avoid it, you will get into trouble. The troubles are not unmanageable but frustrating, especially if you need to support different versions of Excel, different languages/localisations, and even different installation options. Maybe you know that you need to use ActiveX, but if you do not, consider using for example a tab-delimited text file, which Excel can read. Indeed. Active-X Excel reports are a headache. If your boss can spring $500 for the Report Generator Toolkit from NI it will save you tons of grief and time. I am convinced that the report toolkit will pay for itself in saved time after the first couple of times you use it. Otherwise, like thols said, use a simple tab-delimited text file. Another option is to use the standard report generator VI's and make HTML documents you can save on your network. 2 Quote Link to comment
asbo Posted November 10, 2009 Report Share Posted November 10, 2009 Despite being yet another ActiveX, the Office Web Components are kind of handy if you need integrated display. It doesn't support XLS natively, though, so there might be some finagling involved. Quote Link to comment
fartbagxp Posted November 10, 2009 Author Report Share Posted November 10, 2009 Wow, thank you for all the response. It is quite an headache to try do something quite simple. I may consider using a comma delimited file instead... Still working my possibilities. Thanks for the suggestions, FrankB and thank you for the code revision, ooth... It's very clear what I did wrong. Quote Link to comment
Phillip Brooks Posted November 11, 2009 Report Share Posted November 11, 2009 Wow, thank you for all the response. It is quite an headache to try do something quite simple. I may consider using a comma delimited file instead... Still working my possibilities. Thanks for the suggestions, FrankB and thank you for the code revision, ooth... It's very clear what I did wrong. You can use ADO to open, read and write to Excel spreadsheets. See this post. Place your raw data from LabVIEW on a separate sheet, then reference the raw data from another sheet to perform calculations or chart the data. 1 Quote Link to comment
RalcoBe Posted April 20, 2010 Report Share Posted April 20, 2010 Me also, I had tons of trouble with the Excel reporting. After a few days I quit. Now I save to csv (raw data) and jpg (export of graphs) and later on, I create a nice HTML document. At least the HTML code is "open", and reads +-the same way in all browsers. The HTML page links to pictures, text, numbers, colors, layout, all generated by the VI. . Quote Link to comment
asbo Posted April 20, 2010 Report Share Posted April 20, 2010 Weird that so many people have problems with Excel. Some of the work I've done was with a toolkit, but using a plain ActiveX interface wasn't all that complicated for my uses, but then I kind of find that sort of automation "fun". Quote Link to comment
RalcoBe Posted April 22, 2010 Report Share Posted April 22, 2010 The basic things, like in the examples, worked. Other things not every time. The I upgraded (LV 8.0 to 8.2 or 8.2 to 8.5, don't know anymore) and everything stopped working. I like my Labview generated HTML code much more and there are no surprises. . Quote Link to comment
ssumaglab Posted April 24, 2010 Report Share Posted April 24, 2010 We're some labview beginners having a similar problem. Maybe you guys can help us out. We're building a similar program just for reading the data out of two keithley 2000 DMMs and making a voltage drop measurement. We're trying to characterize a diode as a project, but we can't get the data to export in a reasonable fashion. We end up getting 1 data point every second or so and the program writes it as its own file. We want a continuous datasheet so that we can analyze the data further. I've attached it so that ya'll can tweak it as necessary or just give us any pointers. BJK_3-way.vi Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.