• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 254
  • Last Modified:

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

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
TrueBlue
Asked:
TrueBlue
  • 3
  • 3
1 Solution
 
ThogekCommented:
Try
    Response.AddHeader "Content-Disposition", "attachment; filename=statement.xls"
0
 
TrueBlueAuthor Commented:
Hi Thogek!

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

Any other ideas?
0
 
ThogekCommented:
What do you mean by "it shows part of the page's URL"?  Where?
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
ThogekCommented:
And make sure that these statements are being called before any Response.Write calls.
0
 
TrueBlueAuthor Commented:
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
 
TrueBlueAuthor Commented:
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now