Right, where to start....!
Firstly, here's what I'm wanting to do:
Have a HTML page that has a form, which writes data to "somewhere".
Due to my ****tyy conmpany, and all the red tape, I do not have access to a webserver, so for those of you that say "get a webserver"; I'll thank you for your comments in advance
I've managed [eventually] to find a script that writes an Excel file, which is spot on, exactly what I wanted. The only problem is that it WRITES an excel file. I want it to UPDATE an excel file.
Here's the code:
I then have an Excel file that has in it:
The Excel code works. But when the ActiveX/HTML form is run again, it replaces the existing excel file. I want it to write to a pre-defined cell within the existing excel file.
Any suggestions (other than "get a webserver")?
TIA, Neil.
Firstly, here's what I'm wanting to do:
Have a HTML page that has a form, which writes data to "somewhere".
Due to my ****tyy conmpany, and all the red tape, I do not have access to a webserver, so for those of you that say "get a webserver"; I'll thank you for your comments in advance
I've managed [eventually] to find a script that writes an Excel file, which is spot on, exactly what I wanted. The only problem is that it WRITES an excel file. I want it to UPDATE an excel file.
Here's the code:
Code:
<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function xlWrite(r,c) {
var xlApp, xlSheet;
xlApp = new ActiveXObject("Excel.Application");
xlApp.Visible = true;
xlApp.Workbooks.Add();
xlSheet = xlApp.ActiveSheet;
xlSheet.Cells(r,c).Value = frm.txt.value;
xlSheet.SaveAs("C:\\xlText.xls");
xlApp.Quit();
xlApp = null;
setTimeout("CollectGarbage()",1);
}
// End -->
</script>
</HEAD>
<FORM NAME="frm">
<INPUT TYPE="Text" NAME="txt" Value="Some cell text">
<INPUT TYPE="Button" VALUE="Put in row 1, column 2" ONCLICK="xlWrite
(1,2)">
</FORM>
Also, to avoid the "File exists, overwrite (Yes,No)" dialog - use
SaveCopyAs instead of SaveAs.
</HTML>
I then have an Excel file that has in it:
Code:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
rowcounter = 2
While Range("a" & rowcounter) <> ""
rowcounter = rowcounter + 1
Wend
Rows("1:1").Copy
Rows(rowcounter).Select
ActiveSheet.Paste
Selection.CutCopyMode = False
End Sub
The Excel code works. But when the ActiveX/HTML form is run again, it replaces the existing excel file. I want it to write to a pre-defined cell within the existing excel file.
Any suggestions (other than "get a webserver")?
TIA, Neil.