Re: Optional Variant

Rick Stoyle <[email protected]>
Newsgroups gmane.comp.windows.devel.jawin
Message-ID <LISTSERV%[email protected]>
The Microsoft documentation for the Excel.Workbook object lists the method
SaveAs as the following:

SaveAs(Filename, FileFormat, Password, WriteResPassword,
ReadOnlyRecommended, CreateBackup, AddToMru, TextCodePage,
TextVisualLayout)

All the parameters except Filename are listed as "Optional Variants"
meaning that if nothing is passed, a default value is assigned. I think a
better description would be a variant of the "No Parameter" type
or "Missing" like you specified.  The _Workbook stub generated by jawin is
as follows:

public void saveAs(Object Filename, Object FileFormat, Object Password,
Object WriteResPassword, Object ReadOnlyRecommended, Object CreateBackup,
int AddToMru, Object TextCodePage) throws COMException { }

I have tried a few different things but keep getting errors back from the
COM object about the passed parameters.  With another bridge I have used,
the following code worked:

...
wbook = new _Workbook("Excel.Sheet");
Variant missing = new Variant();
missing.noParam();
wbook.saveAs(new String("C:\MyExcelFile.xls"), missing, missing, missing,
missing, missing, 1, missing);

But, jawin does not have this type of method for the Variant Object.  What
would the code look like to do the same with jawin.

Rick
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.