Ok everyone, a guy at work needed help with something so I said I will see what I can do.
Basically we work in a call center doing tech support so he gets a document with daily stats for each employee. Now what we are trying to do is pull the stats per person according to employee number. The thing is each computer by default has Excel Viewer, you cannot make changes to any excel file, just read from them. Now when you have the full Excel installed the code works fine. But when you don't you get cannot create activeX Object. Here is our code.
code:
<html>
<head>
</head>
<body>
<script language="VBScript">
Dim ExcelApp, ExcelWB
Dim Cells
Dim objNet
Dim oracle
Dim xc
set objNet = CreateObject("WScript.NetWork")
oracle = "33075" 'objNet.username
document.write("<table border=1 id=table1 bordercolorlight=#FFFFFF bordercolordark=#FFFFFF><tr><td bordercolorlight=#4985B6 bordercolordark=#4985B6 bgcolor=#FFFFFF><p align=center><font size=1 face=Verdana>Stats for: " & oracle & "</font></td></tr><tr><td bordercolorlight=#4985B6 bordercolordark=#4985B6><table border=0 id=table2>")
set ExcelApp = createobject("Excel.Application")
ExcelApp.visible = False
set ExcelWB = ExcelApp.Workbooks.Open("C:\Documents and Settings\Matt\Desktop\Stats\dailystats.xls")
Set Cells = ExcelApp.Worksheets(1).Cells
getpos
printstats
Set ExcelApp = Nothing
Private Function getpos()
for i = 1 to 340
if oracle = TRIM(Cells(i,3).value) then
xc = i
end if
Next
end function
Private Function printstats()
for i = 1 to 43
document.write("<tr><td width=158><font face=Verdana size=1>" & rtrim(trim( Cells(10,i))) & "</font></td><td width=58><font face=Verdana size=1>" & rtrim( trim(Cells(xc,i))) & "</font></td></tr></div>")
Next
end function
</script>
</tr></table></td></tr></table>
</body>
</html>
Now we tried using
code:
set ExcelApp = createobject("Excel.Sheet")
And that failed miserably. Can anyone help us out?