Zaloguj | Zarejestruj | FAQ

Html form to excel sheet

+ Odpowiedz

Posty: 1 Strona 1 z 1

Html form to excel sheet

przez posfog » Śr cze 27, 2018 8:54 am

Morning All,
I am new to the site so forgive me if this is in wrong section or if the message is lengthy.
What i am trying to do is create a single web page that has text fields and radio buttons to allow a user to input data using a touch screen prior to hitting a submit button and for that data to be sent to a single excel file.

Now i have found the following code and it works as it is but unsure on how to get radio buttons to work?
<!DOCTYPE html>
<script language="vbscript" type="text/vbscript">
Sub Sample()
Dim iRow
Set objExcel = CreateObject("Excel.Application")
Set objWorkbook = objExcel.Workbooks.Open("home/Book1.xlsx")
objExcel.Application.Visible = True
objWorkbook.Windows(1).Visible = True
set XlSheet =objWorkbook.Sheets(1)
iRow = 1
With objExcel
Do While .Cells(iRow, 1).value <> ""
.Cells(iRow, 1).activate
iRow = iRow + 1
.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 Sucessfully",vbinformation
End With
Set objWorkbook = Nothing
Set objExcel = Nothing
End Sub



First name:<br>
<input type="text" name="fname" Value=""><br>
Last name:<br>
<input type="text" name="lname" Value=""><br>
<input type="text" name="Add1" Value=""><br>
Address2 :<br>
<input type="text" name="Add2" Value=""><br>
<input type="button" onclick="Sample()" value="Submit" /><br>

Also i am not too sure what the values are for at the ends of the following line of coding?

Hope there is someone on this forum who is able to help at all.

Kind Regards
Avatar użytkownika


  • Posty: 1
  • Dołączył(a): Śr cze 27, 2018 8:52 am

+ Odpowiedz

Strona 1 z 1