LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

ActiveX Variants, XL Workbook.SaveAs Method

Emailed cc:s appreciated.

Trying to use Excel Workbook.SaveAs method in LV 5.1 .
I can't seem to wire the inputs correctly to avoid a runtime
error (LV error cluster code == 1004, source = "Exception
occured in Microsoft Excel, SaveAs method of Workbook
class failed. Help Path is XLMAIN8.HLP and context 0 in ")

I'm trying to SaveAs with the following inputs to the method,
in the format of WhatIwire (type)--------VariantName (optionality
according to ExcelVBhelp|according to LV node shading)

Myfile.xls ($)-----Filename (optional|req'd)
"xlWorkbookNormal" ($)--------FileFormat (optional|req'd)
something ($)--------Password (optional|req'd)
something ($)--------WriteResPassword (optional|req'd)
F (bool)---------
ReadOnlyRecommended (optional|req'd)
F (bool)---------CreateBackup (optional|req'd)
xlExclusive (I32)---------AccessMode (optional|req'd)
not wired-----ConflictResolution (optional|opt.)
not wired-----AddToMru (optional|opt.)
not wired-----TextCodePage (optional|opt.)
not wired-----VisualTextLayout (optional|opt.)

What's wrong? Am I missing something obvious?

What's with the disparity between what ExcelVBhelp
says is optional and what LV requires?

How do I tell what appropriate values for the input
variants of some generic method are? I'ld like to be
able to fathom this without having to run to technical
support or the ngs each time.

Again, emails appreciated. ___________Marty
0 Kudos
Message 1 of 2
(3,694 Views)
Marty:

Here's a solution that worked for me. I wire any valid filename string
to the Filename property. For the FileFormat parameter, just before
the SaveAs Invoke Node, I create a Property Node and read the
FileFormat Property from the ActiveX session and feed the value into
the FileFormat input of the SaveAs function. For the next four
parameters (Password thru CreateBackup) I create an OLE Variant control
and hide it. These seem to want some value, the type of which I can't
determine, and since I don't use these parameters, wiring the Variants
seems to keep errors at bay. Finally, I create a constant for
AccessMode and set it to "xlExclusive". This setup seems to work OK
for me. I hope it helps you out.

MaxMar


* Sent from RemarQ http://www.remarq.com The Internet
's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!
0 Kudos
Message 2 of 2
(3,694 Views)