activating windows
On Mar 10, 3:14*pm, GS wrote:
Matthew Dyer was thinking very hard :
On Mar 10, 2:37 pm, GS wrote:
GS used his keyboard to write :
If Not sName = "" Then Workbooks(sName).Activate
change to...
If Not sName = "" Then Application.Windows(sName).Activate
--
Garry
Free usenet access athttp://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc
sorry garry, but it isnt working.
For Each wnd In Application.Windows
* * If InStr(1, wnd.Caption, TextIn, vbTextCompare) 0 Then _
* * GetWkbNameFromWindow = wnd.Caption: Exit Function
* Next
wnd comes back as Nothing and remains nothing throughout when the code
is run. I ran it with breaks. It also appears to be running only for
the 'active' window and not trying to pull data from any of the other
windows to find the match.
Are you using the function 'as posted'? It will only work if there's at
least 1 workbook open. If more then it steps through each window to
check if the string you passed is contained in its Caption. What are
you doing different that's making it NOT work?
--
Garry
Free usenet access athttp://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc- Hide quoted text -
- Show quoted text -
copy/paste of the function with no modifications. I think Clif may be
on to something about it being a different instance of excel...
reccomendations?
|