ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Open a file in another Workbook (https://www.excelbanter.com/excel-programming/440579-open-file-another-workbook.html)

Philosophaie

Open a file in another Workbook
 
Dim XLApp As Excel.Application
Dim XLBook As Excel.Workbook
Set XLApp = CreateObject("Excel.Application")

'how do you word the opening of another preexisting file different than
'the current activesheet using Early binding? How do you link the two?
I tried:
'XLApp.Open ("c:\path\file.xls")
'XLApp.XLBook.Open ("c:\path\file.xls") they did not work


I also want to do the same for Access:

Dim AccApp As Access.Application

or something similar plus be able to manipulate the data from Excel to
Access would be nice.


Chip Pearson

Open a file in another Workbook
 


Try

Set XLBook = XLApp.Workbooks.Open ("C:\path\file.xls")

If all you need to do with your Access data is to query and/or change
records in a database, you can simply access the database directly via
ADO. You don't need to go through the Access application at all.

Cordially,
Chip Pearson
Microsoft MVP 1998 - 2010
Pearson Software Consulting, LLC
www.cpearson.com
[email on web site]



On Fri, 12 Mar 2010 14:05:01 -0800, Philosophaie
wrote:

Dim XLApp As Excel.Application
Dim XLBook As Excel.Workbook
Set XLApp = CreateObject("Excel.Application")

'how do you word the opening of another preexisting file different than
'the current activesheet using Early binding? How do you link the two?
I tried:
'XLApp.Open ("c:\path\file.xls")
'XLApp.XLBook.Open ("c:\path\file.xls") they did not work


I also want to do the same for Access:

Dim AccApp As Access.Application

or something similar plus be able to manipulate the data from Excel to
Access would be nice.



All times are GMT +1. The time now is 01:34 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com