Solved

Call SaveAs dialog, after creating a file.

Posted on 2004-09-10
6
194 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
Comment Utility
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
Comment Utility
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
Comment Utility
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
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 utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

744 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

17 Experts available now in Live!

Get 1:1 Help Now