从Html表单写入Excel文档

在内部networking上,我想写一个内部Web表单上的同事填写到excel数据库。

经过一番研究后,我想出了下面的代码,但我似乎无法让它为我工作。

任何帮助,将不胜感激。

<script language="vbscript" type="text/vbscript"> Sub Divert () Dim iRow Set objExcel = CreateObject ("Excel. Application") Set objWorkbook = objExcel.Workbooks.Open ("G:\Bournemouth\CorporateShared\General Insurance\GI complaint Team\Baxter Diverted\diverted.xlsx") objExcel.Application.Visible = True ObjWorkbook.Windows (1).Visible = True Set XlSheet =objWorkbook.Sheets (1) XlSheet.Activate iRow = 1 With objExcel Do while .Cells (iRow, 1).value <> "" .Cells (iRow, 1).activate iRow = iRow + 1 Loop .Cells (iRow, 1).value=Document.GetElementsByName ("date") (0).Value .Cells (iRow, 2).value=Document.GetElementsByName ("date1") (0).Value .Cells (iRow, 3).value=Document.GetElementsByName ("name") (0).Value .Cells (iRow, 4).value=Document.GetElementsByName ("acti") (0).Value .Cells (iRow, 5).value=Document.GetElementsByName ("supwho") (0).Value .Cells (iRow, 6).value=Document.GetElementsByName ("prowhi") (0).Value .Cells (iRow, 7).value=Document.GetElementsByName ("trawha") (0).Value .Cells (iRow, 8).value=Document.GetElementsByName ("hanwho") (0).Value .Cells (iRow, 9).value=Document.GetElementsByName ("prowha") (0).Value .Cells (iRow, 10).value=Document.GetElementsByName ("surwho") (0).Value .Cells (iRow, 11).value=Document.GetElementsByName ("letwho") (0).Value .Cells (iRow, 12).value=Document.GetElementsByName ("miwha") (0).Value .Cells (iRow, 13).value=Document.GetElementsByName ("miwho") (0).Value .Cells (iRow, 14).value=Document.GetElementsByName ("time") (0).Value .Cells (iRow, 15).value=Document.GetElementsByName ("desc") (0).Value MsgBox "Diverted time updated”, vbinformation Document.GetElementsByName ("date") (0).Value="" Document.GetElementsByName ("date1") (0).Value="" Document.GetElementsByName ("name") (0).Value="" Document.GetElementsByName ("acti") (0).Value="" Document.GetElementsByName ("supwho") (0).Value="" Document.GetElementsByName ("prowhi") (0).Value="" Document.GetElementsByName ("trawha") (0).Value="" Document.GetElementsByName ("hanwho") (0).Value="" Document.GetElementsByName ("prowha") (0).Value="" Document.GetElementsByName ("surwho") (0).Value="" Document.GetElementsByName ("letwho") (0).Value="" Document.GetElementsByName ("miwha") (0).Value="" Document.GetElementsByName ("miwho") (0).Value="" Document.GetElementsByName ("time") (0).Value="" Document.GetElementsByName ("desc") (0).Value="" End With ObjWorkbook.Save ObjWorkbook.Close Set objWorkbook = Nothing Set objExcel = Nothing End Sub </script> 

我填写表格并点击我的提交button代码:

 <input type="button" onclick="Divert()" value="Submit" /> 

它根本不保存到文档中,也不会显示确认框

可以有一个设置,我没有设置在Excel文档或类似的东西,从我可以看到的代码应该工作?

谢谢