Launch Excel & open existing WB 
Author Message
 Launch Excel & open existing WB

I'd like to make a link from my web page that would launch
Excel and open an existing file in Excel (rather than
opening it within the browser).  KB Article 198703 gives
the code, but opens a new instance of an Excel spreadsheet
and, not knowing the code, I don't know how to modify "set
wb=app.workbooks.add" into something that would open an
existing workbook.  Thanks.


Sun, 13 Nov 2005 01:12:39 GMT  
 Launch Excel & open existing WB
Diane,
Here's a test vbs file I've created to open an existsing Excel file, add the
current date then save and close the file.  I run this from the command
line.
cheers
peterDavey


Quote:
> I'd like to make a link from my web page that would launch
> Excel and open an existing file in Excel (rather than
> opening it within the browser).  KB Article 198703 gives
> the code, but opens a new instance of an Excel spreadsheet
> and, not knowing the code, I don't know how to modify "set
> wb=app.workbooks.add" into something that would open an
> existing workbook.  Thanks.



Sun, 13 Nov 2005 06:39:10 GMT  
 Launch Excel & open existing WB
I'm sorry, but I don't see the test file you sent or attached.  How do I
get it?  Thanks.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



Sun, 13 Nov 2005 11:58:54 GMT  
 Launch Excel & open existing WB
Diane,
Sorry, I was sure I'd pasted it in.  Here it is:

'---------------------------------------------------------------------------
---
' test VB script

set WshShell = Wscript.CreateObject("WScript.Shell")

set XlObj = CReateObject("Excel.Application")
set wkb = XlObj.workbooks.open("D:\Other\IT-Stuff\TestFiles\Test1.xls")

wkb.worksheets(1).Range("A2").value = date ' put date in cell A2
wkb.close True   ' close and save

set WshShell = Nothing
set XlObj = Nothing
set wkb = Nothing
'---------------------------------------------------------------------------
---
It opens a test workbook and enters the current date into a cell.  The
workbook has a Workbook_Open sub that refreshes a data query that extracts
records from an external database using the date as a parameter.  It works
well.

cheers
peterDavey


Quote:
> I'm sorry, but I don't see the test file you sent or attached.  How do I
> get it?  Thanks.

> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!



Mon, 14 Nov 2005 06:55:33 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Opening an existing excel file from HTML

2. Using VBS to open existing excel document

3. Launching An Excel Application, if open then activate

4. launch & use excel via automation

5. Open Excel in existing Form

6. How to edit the existing opening Excel file?

7. Opening existing Excel file through VB 5.0

8. Problem with opening Excel after opening Excel inside Microsoft Internet Controls

9. Opening & Closing Access from Excel

10. Writing Excel Files W/O Existing Excel Application

11. opening & saving excel from an asp page

12. Open another database and keep existing one open

 

 
Powered by phpBB® Forum Software