Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default selecting a specific excel instance

Hi all,

I'm looking for a way, to catch a specific excel instance and use
their objects (fill in data f.e.) . I my case, there are several
excels (listed in the taskbar) - f.e.five - and I want to access the
instance with the title "Microsoft Excel - Test1.xls.". I tried that
with findwindow-api, but I think, a can't acess the excel object via
this window handle, right ?
Any idea to solve this problem ?

Thanks in advance

Henning

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 53
Default selecting a specific excel instance

You can access an open document by using the following code:
Windows("Book2.xls").Activate ' Activate a document
Sheets("Sheet2").Select ' Select the proper sheet in that document

Stephane.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default selecting a specific excel instance

Hi Henning,

If you know the full path to your file Text1.xls you can do something like
this -

Sub test()
Dim objWB As Object ' Excel.Workbook
Dim xlApp As Object ' Excel.Application

Set objWB = GetObject("C:\Temp\Test1.xls")
Set xlApp = objWB.Parent

End Sub

If your code is in Excel, or in some other app with a reference to Excel,
change 'As Object' to the appropriate Excel object type.

If you don't know the path it's much more difficult.

Regards,
Peter T

"Henning Winkler" wrote in message
ps.com...
Hi all,

I'm looking for a way, to catch a specific excel instance and use
their objects (fill in data f.e.) . I my case, there are several
excels (listed in the taskbar) - f.e.five - and I want to access the
instance with the title "Microsoft Excel - Test1.xls.". I tried that
with findwindow-api, but I think, a can't acess the excel object via
this window handle, right ?
Any idea to solve this problem ?

Thanks in advance

Henning



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default selecting a specific excel instance

Henning,
First make sure you actually have multiple instances and not multiple
workbooks open in the same instance.
Check the setting ToolsOptionsViewWindows in Taskbar.

If you are working in the same instance, it is more simple:
Dim WB as workbook

set wb=workbooks("SomeWorkbook.xls")

Otherwise look in GetObject.

You can use the Windows API, but automation/COM is more straight forward.
But depends on your situation/requirements.

NickHK

"Henning Winkler" wrote in message
ps.com...
Hi all,

I'm looking for a way, to catch a specific excel instance and use
their objects (fill in data f.e.) . I my case, there are several
excels (listed in the taskbar) - f.e.five - and I want to access the
instance with the title "Microsoft Excel - Test1.xls.". I tried that
with findwindow-api, but I think, a can't acess the excel object via
this window handle, right ?
Any idea to solve this problem ?

Thanks in advance

Henning



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Selecting a specific worksheet Jackie New Users to Excel 5 February 25th 09 07:03 PM
Selecting a specific tab in a tabstrip Dan Excel Programming 6 June 1st 07 09:34 PM
How do I get one instance of Excel to communicate with another instance? [email protected] Excel Programming 3 November 21st 06 10:31 PM
Counting columns with 1 instance of a specific value [email protected] Excel Programming 2 September 14th 06 01:46 PM
Selecting specific excel charts using VBA Mithi_M Excel Programming 3 July 25th 04 01:59 AM


All times are GMT +1. The time now is 08:53 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"