LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

ActiveX ->Excel->SaveAs Method Filename optional??

Hi NG,
we use ActiveX to write data into an Excel-File for further investigation.
After transmitted the data I want to save the workbook using the SaveAs
Method. There I have to set the Filename although this parameter is named as
optional in the help-context. Giving the Filename doesn't make sens because
in that case I can use the Save Method
So,
Is it just an mistake of NI?? and how can I fix the method so that I don't
have to set the filename??

Thanks for help

Bruno
0 Kudos
Message 1 of 2
(3,345 Views)
Hi Bruno.

It seems you have these two functions reversed. I use both of them regularly. The SaveAs method is
used to provide a new filename, while the Save command is used if the filename is already provided
and you don't want it changed.

Typical senario:
Pass 1:
Open template Excel file using the Open method (Master.xls)
Write block of data to specific sheet
Use SaveAs method to write file using a specified file name (000204-1.xls)

Pass 2:
Open data file using Open method (000204-1.xls)
Write additional block of data to specified sheet
Update the file using the Save method (000204-1.xls)

Use the SaveAs method only to change the name of the file. If the filename is already specified and
you want to re-write the file, use the Save method. Ignore the help-con
text that says that the
filename is optional for the SaveAs method. That is only useful if you are programming in VBA for
Excel and you want to write the file using the default name (ie. Book1.xls) and don't want the
typical SaveAs dialog box.

- Michael

Bruno Hartmann wrote:

> Hi NG,
> we use ActiveX to write data into an Excel-File for further investigation.
> After transmitted the data I want to save the workbook using the SaveAs
> Method. There I have to set the Filename although this parameter is named as
> optional in the help-context. Giving the Filename doesn't make sens because
> in that case I can use the Save Method
> So,
> Is it just an mistake of NI?? and how can I fix the method so that I don't
> have to set the filename??
>
> Thanks for help
>
> Bruno

--
Michael Munroe Mailto:mmunroe@abcdefirm.com
A Better Complete Development Engineering Firm
San Mateo, CA 94403 http://www.abcdefirm.com
Michael Munroe, CLD, CTD, MCP
Automate 1M+ VI Search, Sort and Edit operations with Property Inspector 5.1, now with a new Interactive Window Manager!
Now supports full project automation using one-click custom macros or CLI.
0 Kudos
Message 2 of 2
(3,345 Views)