TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
sree vithya
NA
1
1k
How to save login data in Excel worksheet using html ?
Jan 30 2016 12:29 AM
What i need
I need to save login data in excel sheet while user click submit button in html.
Still what i done
using vb-script i have done this.
Errors
Sub Sample() undefined script errors.
data not saving
dialog box not responding
this is my excel sheet
<!DOCTYPE html>
<html>
<head>
<script language="vbscript" type="text/vbscript">
Sub Sample()
debugger;
Dim iRow
Set objExcel = CreateObject("Excel.Application")
Set objWorkbook = objExcel.Workbooks.Open("E:\excel\work.xlsx")
'Document.GetElementsByName("fname")(0).Value="C#"
'Document.GetElementsByName("lname")(0).Value="Corner"
'Document.GetElementsByName("Add1")(0).Value="Tamilnadu"
'Document.GetElementsByName("Add2")(0).Value="Coimbatore"
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("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
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
</script>
<style type="text/css">
fieldset {
border: #00cc00 2px solid;
padding: 10px;
color:green;
</style>
<body
<form>
<fieldset>
<legend>Csharpcorner</legend>
<center>
<img src="C:\Users\Karthikeyan.K\Desktop\Add-Male-User.png" alt="Mountain View"><br>
First name:<br>
<input type="text" name="fname" Value=""><br>
Last name:<br>
<input type="text" name="lname" Value=""><br>
Address1:<br>
<input type="text" name="Add1" Value=""><br>
Address2 :<br>
<input type="text" name="Add2" Value=""><br>
<br>
<input type="button" onclick="Sample()" value="Submit" /><br>
</center>
</fieldset>
<form>
</body>
</html>
Reply
Answers (
0
)
Best approach for globalization automation testing
How to pass the session ?