ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   is it possible? please (https://www.excelbanter.com/excel-programming/321027-possible-please.html)

tom taol

is it possible? please
 


the excel file is opend.

Dim xlApp As Excel.Application

Set xlApp = CreateObject("excel.application")

'see the below
'i want to open the specific excel file of the other excel instance. and
then I want to handle the "prob.xls" with current excel application.
ex)xlApp.sheets(2).select

xlApp.open("c:/fig/prob.xls")

xlApp.sheets(2).select

MsgBox xlApp.sheets(2).range("B2").value

shortly, i want to open 2 Excel applications. as below.
window start menu - run - excel - enter
once more,,
window start menu - run - excel - enter

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

Dan Gardner

is it possible? please
 
I think this is what your looking for but I could be wrong,
in VBA to open an existing excel file you can use the following code

Name = "File Path"
workbooks.open Name

Within your program to negotiate between open workbooks

workbooks("Name of Workbook").Activate

works pretty good, you can even string a worksheets on so

workbooks("XXXXX").worksheets("XXXXXX").activate

you can use numbers instead of names with the workbooks and worksheets
commands, i.e. workbook(1).worksheet(1).cells(XX, XX).value but I find I get
lost, so I prefer to use the actual names, hence ("XXXX")



Vic Eldridge[_3_]

is it possible? please
 
shortly, i want to open 2 Excel applications. as below.
window start menu - run - excel - enter
once more,,
window start menu - run - excel - enter


It won't work Tom.
GetObject() is the only way to connect to a manually started instance.
If multiple instances are running, GetObject() will connect to only one of
them.
GetObject() provides no control over which instance it connects to.

Try to start both instances programatically and establish your connections
there.

Regards,
Vic Eldridge


"tom taol" wrote:



the excel file is opend.

Dim xlApp As Excel.Application

Set xlApp = CreateObject("excel.application")

'see the below
'i want to open the specific excel file of the other excel instance. and
then I want to handle the "prob.xls" with current excel application.
ex)xlApp.sheets(2).select

xlApp.open("c:/fig/prob.xls")

xlApp.sheets(2).select

MsgBox xlApp.sheets(2).range("B2").value

shortly, i want to open 2 Excel applications. as below.
window start menu - run - excel - enter
once more,,
window start menu - run - excel - enter

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



All times are GMT +1. The time now is 06:04 PM.

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