Can I open a specific Excel file from within Access 
Author Message
 Can I open a specific Excel file from within Access

Hi there

I would like to be able to open a specific Excel file from within Access
using a button on a form

Help



Tue, 13 Mar 2001 03:00:00 GMT  
 Can I open a specific Excel file from within Access
Create a VBA eventprocedure with the following code:

Dim xlAppl as Excel.Application
Set xlAppl = CreateObject("<location of excel file>")

Be sure to have set a reference to the Excel object library (via Tools - References)


Quote:
> Hi there

> I would like to be able to open a specific Excel file from within Access
> using a button on a form

> Help



Tue, 13 Mar 2001 03:00:00 GMT  
 Can I open a specific Excel file from within Access
Actually, FWIW, if you were to modify that snippet as

Dim xlAppl as Object
set xlAppl=CreateObject("Excel.Application")
xlAppl.Workbooks.Open "C:\SomeWork.xls"

you then won't need to set a reference to Excel library.

OTOH, if you rewrote it as

Dim xlAppl as Excel.Application
set xlAppl = New Excel.Application
xlAppl.Workbooks.Open "C:\SomeWork.xls"

then you would need the reference.

The code to open the workbook itself remains the same in either case.

HTH
--
Dev Ashish (Just my $.001)
---------------
The Access Web ( http://home.att.net/~dashish )
---------------

:Create a VBA eventprocedure with the following code:
:
:Dim xlAppl as Excel.Application
:Set xlAppl = CreateObject("<location of excel file>")
:
:Be sure to have set a reference to the Excel object library (via Tools -
References)
:


:> Hi there
:>
:> I would like to be able to open a specific Excel file from within Access
:> using a button on a form
:>
:> Help
:>
:>
:>
:>
:>



Wed, 14 Mar 2001 03:00:00 GMT  
 Can I open a specific Excel file from within Access
I knew all that, but I tried to be a smart ass by coding it a little bit shorter. I'm surprised that it doesn't
work (which seems to be the case after I tried it).


Quote:
> Actually, FWIW, if you were to modify that snippet as

> Dim xlAppl as Object
> set xlAppl=CreateObject("Excel.Application")
> xlAppl.Workbooks.Open "C:\SomeWork.xls"

> you then won't need to set a reference to Excel library.

> OTOH, if you rewrote it as

> Dim xlAppl as Excel.Application
> set xlAppl = New Excel.Application
> xlAppl.Workbooks.Open "C:\SomeWork.xls"

> then you would need the reference.

> The code to open the workbook itself remains the same in either case.

> HTH
> --
> Dev Ashish (Just my $.001)
> ---------------
> The Access Web ( http://home.att.net/~dashish )
> ---------------


> :Create a VBA eventprocedure with the following code:
> :
> :Dim xlAppl as Excel.Application
> :Set xlAppl = CreateObject("<location of excel file>")
> :
> :Be sure to have set a reference to the Excel object library (via Tools -
> References)
> :


> :> Hi there
> :>
> :> I would like to be able to open a specific Excel file from within Access
> :> using a button on a form
> :>
> :> Help
> :>
> :>
> :>
> :>
> :>



Thu, 15 Mar 2001 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. handle for a specific open Excel file

2. Using GetObject to open file in a specific instance of Excel

3. Opening Excel Template from within Access

4. Open excel spreadsheet from within Access using VBA

5. Open Excel file within Browser

6. Opening an excel file through a form/running excel macros through access

7. Accessing an Excel file without opening Excel

8. Cans access2.0 engine access btrieve files?

9. Need to make a specific HTTP request from within Excel

10. Invoking Excel from within VB + executing a specific module (NOT auto_Open)

11. opening another .mdb file within access

12. Open different database file within Access using code

 

 
Powered by phpBB® Forum Software