grantwilliams
Programmer
To all you JavaScript gurus out there!
Below is a copy of a script I'm working on that allows a user to export form values to a named Excel Spreadsheet and then allows the spreadsheet to be saved where the user chooses using the
function.
It WAS working... to a certain extent. When it was working, it wasn't saving as the file listed in the box, rather the "default" value referred to in the '
' line. Now it just opens the spreadsheet, puts the values in and displays the Save As dialog box.
Can anyone see why this isn't working?
Thanks,
Grant
Below is a copy of a script I'm working on that allows a user to export form values to a named Excel Spreadsheet and then allows the spreadsheet to be saved where the user chooses using the
Code:
GetSaveAsFilename()
It WAS working... to a certain extent. When it was working, it wasn't saving as the file listed in the box, rather the "default" value referred to in the '
Code:
if (fname = "false")
Can anyone see why this isn't working?
Thanks,
Grant
Code:
function cmdExport(form)
{
var xls = new ActiveXObject ( "Excel.Application" );
xls.visible = true;
var x1FileName = "C:\\2003 Charges calculator.xls";
var x1Book = xls.Workbooks.Open(x1FileName);
xls.ActiveSheet.Cells(4,2).Value = form.numfiles.Value;
xls.ActiveSheet.Cells(5,2).Value = form.numpages.Value;
xls.ActiveSheet.Cells(6,2).Value = form.numdocs.Value;
xls.ActiveSheet.Cells(7,2).Value = form.numexpages.Value;
xls.ActiveSheet.Cells(8,2).Value = form.pagedel.Value;
xls.ActiveSheet.Cells(9,2).Value = form.thirdparty.Value;
var fname = xls.Application.GetSaveAsFilename("FOI Estimate.xls");
if (fname="false"){
fname="C:\\FOI Estimate.xls";
}
x1Book.SaveAs(fname);
x1Book.Close;
xls.visible = false;
xls.Quit();
}