title: How to send html form data to excel file
body: <p>how to send form data like username and email field data by using java script then it has to be stored in excel file by clicking a button and also that code should run on all browsers??
  Before I was running this vb code under script tag executed in IE even there also I can't see any data filled in that  excel file.</p>
  
  <pre><code>Sub sample()  
            Dim iRow  
            Set objExcel = CreateObject ("Excel.Application")  
            Set objWorkbook = objExcel.Workbooks.Open("D:\Users\users.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 &lt;&gt; ""  
                    .Cells (iRow, 1).activate  
                    iRow = iRow + 1  
                Loop  
                   .Cells (iRow, 1).value=Document.GetElementsByName("fname")(0).Value  
                   .Cells (iRow, 2).value=Document.GetElementsByName("lname")(0).Value  
                   .Cells (iRow, 3).value=Document.GetElementsByName("Add1")(0).Value  
                   .Cells (iRow, 4).value=Document.GetElementsByName("Add2")(0).Value  
                   MsgBox "Data Added Successfully”, vbinformation  
                   Document.GetElementsByName ("fname") (0).Value=""  
                   Document.GetElementsByName ("lname") (0).Value=""  
                   Document.GetElementsByName ("Add1") (0).Value=""  
                   Document.GetElementsByName ("Add2") (0).Value=""  
               End With  
               ObjWorkbook.Save  
               ObjWorkbook.Close  
               Set objWorkbook = Nothing  
               Set objExcel = Nothing  
           End Sub
  </code></pre>