What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » Matty needs VBScript help.

Matty needs VBScript help.
Author: Message:
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
O.P. Matty needs VBScript help.
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?
01-29-2005 07:50 AM
Profile E-Mail PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
Matty needs VBScript help. - by matty on 01-29-2005 at 07:50 AM
RE: Matty needs VBScript help. - by kao on 01-29-2005 at 01:40 PM
RE: Matty needs VBScript help. - by segosa on 01-29-2005 at 03:39 PM
RE: Matty needs VBScript help. - by CookieRevised on 02-12-2005 at 03:59 PM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On