Solved

Call SaveAs dialog, after creating a file.

Posted on 2004-09-10
6
201 Views
Last Modified: 2013-11-13
hi all

i have created an xls file in vb using the excel object.
when this file has been created, i need to be able to display the SaveAs dialog box, so the user can download it (i am accessing my vb com through asp).
does anyone know how to do this?

thanks in advance...
0
Comment
Question by:asphead
  • 2
6 Comments
 
LVL 3

Expert Comment

by:rinksno1
ID: 12033600
after creating the excel file....save the file using ...

'Note: for the below example to work you have to make sure that your current folder where your excel file to be saved must have write permission for evey one....

tempfilename="sample"

filepath=server.MapPath(".") & "\" & tempfilename & ".xls"
Set MyFileObject = CreateObject("Scripting.FileSystemObject")
if myfileobject.FileExists(filepath)=true then
      MyFileObject.DeleteFile filepath
end if


...
.   'excel file generation using Active x DLL
.
.
.
.

AppWorld.ActiveWorkbook.SaveAs [filepath]          
AppWorld.ActiveWorkbook.Close
AppWorld.Application.Quit
Set Appworld=Nothing


Response.Redirect tempfilename & ".xls"

'''this will redirect to the excel file generated if the user had excel installed then the excel file will be displayed on the browser other wise it will show download now ....


rinks
0
 

Author Comment

by:asphead
ID: 12042231
thanks rinks. the thing is, i want to be able to display the saveAs dialog box, so the user has the option to either save the file down, or to open it.
any idea if u can do this?
0
 
LVL 3

Accepted Solution

by:
rinksno1 earned 250 total points
ID: 12051541
there is way you can display the save as dialog box in ASP, the save as dialog box is a part of active control "Commondialog" and it cannot be used in ASP unless active x is enabled in the page which is a security threat....to users...

rinks
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

856 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