G
Guest
I have coded java script and placed it into my code, by I have never used
VBScript.
Can I use VBScript with a C# page?
No matter where I place this script, it never successfully compiles in
VS.Net, I always am getting an error indicating the procedure was not found.
My code looks like the following...
<asp:button id="exportbutton" runat="server" Text="Create Excel File"
onclick="exportbutton_onclick()"></asp:button>
<script language="vbscript">
Sub exportbutton_onclick()
Dim sHTML, oExcel, oBook
sHTML = document.all.item("DataGrid1").outerhtml
Set oExcel = CreateObject("Excel.Application")=
Set oBook = oExcel.Workbooks.Add
oBook.HTMLProject.HTMLProjectItems("Sheet1").Text = sHTML
oBook.HTMLProject.RefreshDocument
oExcel.Visible = true
oExcel.UserControl = true
End Sub
</script>
The example that I am looking at tells me to place the script after the
</HTML> tag, which looks like a strange place to pu it. But I have tried
placing it in the body and in the head with the same result.
The example also does not show a "()" after the end of the method name, and
I added that , but both with and without, I get the same results.
What am I doing wrong?
VS.Net allows me to create a VBScript File, if I use this file, how do I get
it pulled in for processing?
Thanks
VBScript.
Can I use VBScript with a C# page?
No matter where I place this script, it never successfully compiles in
VS.Net, I always am getting an error indicating the procedure was not found.
My code looks like the following...
<asp:button id="exportbutton" runat="server" Text="Create Excel File"
onclick="exportbutton_onclick()"></asp:button>
<script language="vbscript">
Sub exportbutton_onclick()
Dim sHTML, oExcel, oBook
sHTML = document.all.item("DataGrid1").outerhtml
Set oExcel = CreateObject("Excel.Application")=
Set oBook = oExcel.Workbooks.Add
oBook.HTMLProject.HTMLProjectItems("Sheet1").Text = sHTML
oBook.HTMLProject.RefreshDocument
oExcel.Visible = true
oExcel.UserControl = true
End Sub
</script>
The example that I am looking at tells me to place the script after the
</HTML> tag, which looks like a strange place to pu it. But I have tried
placing it in the body and in the head with the same result.
The example also does not show a "()" after the end of the method name, and
I added that , but both with and without, I get the same results.
What am I doing wrong?
VS.Net allows me to create a VBScript File, if I use this file, how do I get
it pulled in for processing?
Thanks