Solved

Call SaveAs dialog, after creating a file.

Posted on 2004-09-10
6
196 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to debug this code 7 56
Microsoft Access combo box help 2 37
vb6 connector to SQL Server 2 34
RDP Connection Issues 12 64
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…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

929 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now