Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

When calling Excel the assigned file name is substituted with part of the URL

Posted on 2004-10-01
6
246 Views
Last Modified: 2008-02-20
Hi!

I have the following VBScript code:

For some reason when the page is called instead of passing the below listed filename it shows part of the page's URL which will not work with Excel.

Any ideas?

     ' set the filename to statement.xls
      Response.AddHeader "Content-Disposition", "filename=statement.xls"
     ' set the mime type to Microsoft Excel
      Response.ContentType = "application/vnd.ms-excel"
0
Comment
Question by:TrueBlue
  • 3
  • 3
6 Comments
 
LVL 15

Expert Comment

by:Thogek
ID: 12205906
Try
    Response.AddHeader "Content-Disposition", "attachment; filename=statement.xls"
0
 

Author Comment

by:TrueBlue
ID: 12205956
Hi Thogek!

I tried your suggestion, but I am still getting the same problem.

Any other ideas?
0
 
LVL 15

Expert Comment

by:Thogek
ID: 12206040
What do you mean by "it shows part of the page's URL"?  Where?
0
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 15

Accepted Solution

by:
Thogek earned 250 total points
ID: 12206043
And make sure that these statements are being called before any Response.Write calls.
0
 

Author Comment

by:TrueBlue
ID: 12206046
Hi Thogek!

When the window pops up. It says "Do you want to open or save this file?"
Name: ExcelAROpenTrans_ASP?ID=1234
Type: Microsoft Excel Worksheet, 2.57KB
From: secured.domain.com
0
 

Author Comment

by:TrueBlue
ID: 12206072
Hi Thogek!

I figured it out. There was a type mismatch that was causing the wrong filename to be displayed.

I commented out the lines so that the data would be displayed on the screen as opposed to being sent to Excel and discovered the mismatch error.

Thank you.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

838 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question