Saving Excel to web site

V

Vikram

Hi,

Given below is my task.

An user can open the xls file from my website (loaded on the top frame).
After filling the Excel, he can click a send button at the bottom frame. By
clicking the button i have to save the file in a shared directory on the web
server by a unique name.

Is it possible ?

Any tips of how to do this ?
 
S

SPA

You cannot directly save the opened excel file onto the server from the
client machine (as far as I know). But you could have it saved on the client
system and then uploaded to the server using a file upload code.

Clicking the Send button should then handle the following:

1) Save and close the excel file to the client machine (to some pre-defined
folder .. or could prompt the user to save it using Save Dialog box
2) Then upload the file to the pre-defined server directory. You could
append the timestamp with the filename to make it unique.

Hope this helps. Feel free to ask if you need more clarification on the same
:)

SPA
 
S

SPA

Hi

You can find VB code to invoke the File Open / Save dialog boxes. They need to be tweaked to VBScript for it to work in ASP.

If you can get the reference to the Excel workbook object in the lower frame, then you can save it using the syntax:

Activeworkbook.SaveAs filename:=Application.GetSaveAsFilename
(This is the VB Code)

In VB Script, you need to define the Excel Application and Workbook objects using CreteObject and then call the corresponding methods.

Dim oExcelApp ' excel.Application
Dim oWs ' excel.Worksheet
Dim oWb ' excel.Workbook
Dim strFileName ' String

Set oExcelApp = CreateObject("EXCEL.APPLICATION")
Set oWs = oExcelApp.ActiveSheet
Set oWb = oExcelApp.ActiveWorkbook

strFileName = <Filename used when opening the Excel file>
oWb.SaveAs strFilename

(You must set a reference to Excel in the Project | References dialog)

Refer to the following link for an idea on how to use the Excel Application object.
http://msdn.microsoft.com/library/d...tml/deovrworkingwithmicrosoftexcelobjects.asp

You could use the same filename you used to open the excel sheet while saving to the local system too. Once the file is saved, redirect the control to FileUpload page and pass the name of the file (and path if needed) for it to upload the same.

In VB its possible to invoke the SaveAs dialog but I am not sure if we can do that in VBScript by replacing:
strFileName = <Filename used when opening the Excel file>
with
strFileName = Application.GetSaveAsFilename (You could give it a try)

Hope this helps
SPA
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,139
Latest member
JamaalCald
Top