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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Rename a file BEFORE user downloads it

Status
Not open for further replies.

sb13

Programmer
Jun 5, 2002
1
AU
I need to be able to let a user download a generic spreadsheet but when they download it it is given a customised filename.

For example there is a file called GenericTimesheet.xls, and I want users to be able to click on the link and download it as <userID>Timesheet.xls.

Im using VBscript in ASP on IIS.

Help would be greatly appreciated.

Regards

Steve

PS. The reason for this is I need to pass a variable (userid) to excel when it opens. It uses this variable to then access a sql server database (using web query) and download only the users time data. By renaming the file to include the users id I can extract this using VBA when the user opens the spreadsheet for the first time. The alternative is to have asp run a process that places the usersid inside a cell in the xls before they download it! Less desireable.

 
You can use a macro in excel to save itself under a different filename using the UserID you passed in. I did almost the same thing but in word.

I had to create a public macro, you pass in an ID to the macro, its edits itself using bookmarks and values from a database and then it saves itself under a different name, this word file with the macro in it essentially acted as a template.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top