Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Unable to read excel file using VBScript/HTA

Status
Not open for further replies.

cowcool

Technical User
Apr 16, 2003
8
ID
Hi Guys,

I am trying to read content of an excel file using VBS

Here's my code
==============
<html>
<head>
<title>
</title>
<body>

<script language="VBScript">

Set objXL = CreateObject("Excel.Application")
Set objWB = objXL.WorkBooks.Open("C:\test1.xls")
Set objWS = objXL.ActiveWorkBook.WorkSheets("test1")

msgbox objXL.Cells(1, 1).Value

objWB.Close
objXL.Quit
</script>
</body>
</html>

It doesn't work ... All I get is an alert box

"
An ActiveX control on this page might be unsafe to interact with other parts of
the page. Do you want to allow this interaction?"

I hit yes ... and always get a blank page

Where did I make mistake?. I use IE 7.0

Thx!!
 
>It doesn't work ... All I get is an alert box
That is exactly what you put on the page. Nothing else is automatic.
 
Add the location of the file to your trusted sites.

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
I think I just realized what you were expecting was to see Excel open. You would need to add objXL.Visible = True to you code to see Excel open.

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top