Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Looping Through Every Instance of Excel
Hello,
I want to loop through every instance of excel and find an open workbook, I tried this: For i = 1 To app.workbooks.Count + 1 z = app.workbooks(i).Name If InStr(app.workbooks(i).Name, "STXL") Then WB_Found = True Exit For End If Next Unfortunately, this only finds the open workbooks within each individual instance. Is this even possible? Clay |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Looping Through Every Instance of Excel
some have suggested:
set xlapp=getobject(,"fully qualified workbookname").Parent -- Regards, Tom Ogilvy " wrote: Hello, I want to loop through every instance of excel and find an open workbook, I tried this: For i = 1 To app.workbooks.Count + 1 z = app.workbooks(i).Name If InStr(app.workbooks(i).Name, "STXL") Then WB_Found = True Exit For End If Next Unfortunately, this only finds the open workbooks within each individual instance. Is this even possible? Clay |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Looping Through Every Instance of Excel
On Mar 5, 9:17 am, Tom Ogilvy
wrote: some have suggested: set xlapp=getobject(,"fully qualified workbookname").Parent -- Regards, Tom Ogilvy " wrote: Hello, I want to loop through every instance of excel and find an open workbook, I tried this: For i = 1 To app.workbooks.Count + 1 z = app.workbooks(i).Name If InStr(app.workbooks(i).Name, "STXL") Then WB_Found = True Exit For End If Next Unfortunately, this only finds the open workbooks within each individual instance. Is this even possible? Clay- Hide quoted text - - Show quoted text - I don't know the name of the excel workbook, only that the name contains "STXL". |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Looping Through Every Instance of Excel
Maybe this will get you started:
http://vbnet.mvps.org/code/system/fi...likesimple.htm Peter T has a some posts on this subject in this NG. Search through Google. NickHK wrote in message ups.com... On Mar 5, 9:17 am, Tom Ogilvy wrote: some have suggested: set xlapp=getobject(,"fully qualified workbookname").Parent -- Regards, Tom Ogilvy " wrote: Hello, I want to loop through every instance of excel and find an open workbook, I tried this: For i = 1 To app.workbooks.Count + 1 z = app.workbooks(i).Name If InStr(app.workbooks(i).Name, "STXL") Then WB_Found = True Exit For End If Next Unfortunately, this only finds the open workbooks within each individual instance. Is this even possible? Clay- Hide quoted text - - Show quoted text - I don't know the name of the excel workbook, only that the name contains "STXL". |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Looping Through Every Instance of Excel
Yes I have described how I do it once or twice!
Recently in this ng Rama posted a link to this approach to populate a collection of Excel instances which works very well indeed - http://www.mrexcel.com/board2/viewto...37277&start=10 As written it doesn't necessarily catch all instances, in contrast to my rather more clunky method which normally does. Regards, Peter T "NickHK" wrote in message ... Maybe this will get you started: http://vbnet.mvps.org/code/system/fi...likesimple.htm Peter T has a some posts on this subject in this NG. Search through Google. NickHK wrote in message ups.com... On Mar 5, 9:17 am, Tom Ogilvy wrote: some have suggested: set xlapp=getobject(,"fully qualified workbookname").Parent -- Regards, Tom Ogilvy " wrote: Hello, I want to loop through every instance of excel and find an open workbook, I tried this: For i = 1 To app.workbooks.Count + 1 z = app.workbooks(i).Name If InStr(app.workbooks(i).Name, "STXL") Then WB_Found = True Exit For End If Next Unfortunately, this only finds the open workbooks within each individual instance. Is this even possible? Clay- Hide quoted text - - Show quoted text - I don't know the name of the excel workbook, only that the name contains "STXL". |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Looping Through Every Instance of Excel
On Mar 6, 4:45 am, "Peter T" <peter_t@discussions wrote:
Yes I have described how I do it once or twice! Recently in this ng Rama posted a link to this approach to populate a collection of Excel instances which works very well indeed -http://www.mrexcel.com/board2/viewtopic.php?t=237277&start=10 As written it doesn't necessarily catch all instances, in contrast to my rather more clunky method which normally does. Regards, Peter T "NickHK" wrote in message ... Maybe this will get you started: http://vbnet.mvps.org/code/system/fi...likesimple.htm Peter T has a some posts on this subject in this NG. Search through Google. NickHK wrote in message oups.com... On Mar 5, 9:17 am, Tom Ogilvy wrote: some have suggested: set xlapp=getobject(,"fully qualified workbookname").Parent -- Regards, Tom Ogilvy " wrote: Hello, I want to loop through every instance of excel and find an open workbook, I tried this: For i = 1 To app.workbooks.Count + 1 z = app.workbooks(i).Name If InStr(app.workbooks(i).Name, "STXL") Then WB_Found = True Exit For End If Next Unfortunately, this only finds the open workbooks within each individual instance. Is this even possible? Clay- Hide quoted text - - Show quoted text - I don't know the name of the excel workbook, only that the name contains "STXL".- Hide quoted text - - Show quoted text - Thanks everyone this is very helpful. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Excel - New Instance | Excel Discussion (Misc queries) | |||
How do I get one instance of Excel to communicate with another instance? | Excel Programming | |||
How to get all Excel instance | Excel Programming | |||
Excel Instance | Excel Programming | |||
Second instance of Excel | Excel Programming |