Cannot Open Excel File

L

Looch

Was hoping I could get some insight on this. I added a text box and
command button to a web page and added the code in the .vb file to
open an existing Excel file based on what was typed in the text box.

I'm getting the

I'm new to ASP so...

Can I have the Excel file anywhere or does it have to be in an IIS/ASP
related folder? (Getting the ASP user not authorized 80070005 error)

I've added every user (IUSR_machinename) and permission I possibly can
and still can't get it to open. (The same code works in a VB app that
I wrote and copied it from).

Thanks for any advice.
 
M

Mark Rae

Was hoping I could get some insight on this. I added a text box and
command button to a web page and added the code in the .vb file to
open an existing Excel file based on what was typed in the text box.

I'm getting the

I'm new to ASP so...

Can I have the Excel file anywhere or does it have to be in an IIS/ASP
related folder? (Getting the ASP user not authorized 80070005 error)

I've added every user (IUSR_machinename) and permission I possibly can
and still can't get it to open. (The same code works in a VB app that
I wrote and copied it from).

Presumably, you're trying to do server-side automation? Microsoft doesn't
support this because it doesn't work:
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q257757#kb2

Fortunately, there are several other possibilities depending on what you are
trying to do...

What are your requirements for interfacing ASP.NET and Excel...?
 
L

Looch

Mark,

Thanks for your response. The interface between ASP and Excel is very
simple, the only requirement is to open an Excel file who's name
matches the text in the text box. It can either open in the same or a
new window (new preferably) or could open Excel and open the workbook
that way. I was trying to use server-side b/c I'm fairly familiar with
vb.net while my experience with ASP is next to nothing!
 
M

Mark Rae

Thanks for your response. The interface between ASP and Excel is very
simple, the only requirement is to open an Excel file who's name
matches the text in the text box. It can either open in the same or a
new window (new preferably) or could open Excel and open the workbook
that way.

Do you need to do anything other than open an Excel workbook in a browser
window...?
I was trying to use server-side b/c I'm fairly familiar with
vb.net while my experience with ASP is next to nothing!

Sure, but you can't do that because it doesn't work - see the Microsoft
support article which explains this...
 
L

Looch

Do you need to do anything other than open an Excel workbook in a browser
window...?



Just need to open a pre-existing Excel file with the name that matches
what would be entered into a text box.
 
L

Looch

It would help to see a code sample demonstrating how you're trying to do it.
Meanwhile, I'd suggest you take a look at Response.WriteFile, which will
allow you to store the Excel file pretty much anywhere on the server.
Here's more info:http://msdn2.microsoft.com/en-us/library/aa332830(vs.71).aspx

--
I hope this helps,
Steve C. Orr,
MCSD, MVP, CSM, ASPInsiderhttp://SteveOrr.net











- Show quoted text -

Here's the code I'm using. If I just use a simple HTM file the script
code works, but not in an ASP app. I get an error on page message in
the bottom left.

<head runat="server">
<title>Untitled Page</title>
<script language =vbscript >
dim objExcel
Sub cmdOrderFrm_onclick()
call OpenWorkbook("C:Temp\test.xls")
end sub

sub OpenWorkbook(strLocation)
set objExcel = CreateObject("Excel.Application")
objExcel.Visible = true
objExcel.Workbooks.Open (strLocation)
objExcel.UserControl = true
end sub
</script>
</head>

.....

<body>
.....
<input type =button name=cmdOrderFrm value = "OK" style="z-index:
103; left: 173px; position: absolute; top: 337px" />

</body>
 
S

Steve C. Orr [MCSD, MVP, CSM, ASP Insider]

Using client side code for this (as you are attempting) is fraught with a
variety of security related problems.
Therefore I'd suggest using a server side technique like response.WriteFile
instead.
 
M

Mark Rae

Just need to open a pre-existing Excel file with the name that matches
what would be entered into a text box.

Presumably, this Excel file is on the webserver somewhere...?
 
L

Looch

Presumably, this Excel file is on the webserver somewhere...?

Yes. (Would like to move to a separate file server at some point but
on the webserver (IIS on Win XP Pro) for now is ok).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,139
Latest member
JamaalCald
Top