Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Rob Rob is offline
external usenet poster
 
Posts: 718
Default Wildcard to activate another window

Hello. I'm trying to make another window active which will have the file
name of "WIPDrilldownExport(__).xls", where only one character appears in the
parentheses and could be a 1, 2, or 3. The line

Windows("WIPDrilldownExport(#).xls").Activate

doesn't work. Thanks in advance.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Wildcard to activate another window

Option Explicit
Sub testme()
Dim myWindow As Window
For Each myWindow In Application.Windows
If LCase(myWindow.Caption) Like LCase("WIPDrilldownExport(?).xls") Then
myWindow.Activate
Exit For
End If
Next myWindow
End Sub

I usually go through the workbooks collection so I don't have to worry about any
modifications to the window's caption:

Option Explicit
Sub testme()
Dim wkbk As Workbook
For Each wkbk In Application.Workbooks
If LCase(wkbk.Name) Like LCase("WIPDrilldownExport(?).xls") Then
wkbk.Activate
Exit For
End If
Next wkbk
End Sub


Rob wrote:

Hello. I'm trying to make another window active which will have the file
name of "WIPDrilldownExport(__).xls", where only one character appears in the
parentheses and could be a 1, 2, or 3. The line

Windows("WIPDrilldownExport(#).xls").Activate

doesn't work. Thanks in advance.


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Wildcard to activate another window

A procedure to activate the window using a search string. If you are sure
there is not other workbook opened which contain the numeric 1 you can usel
this as
ActivateBookwithKeyword ("1")


Sub ActivateBookwithKeyword(strSearch As String)
For intTemp = 1 To Workbooks.Count
If InStr(1, Workbooks(intTemp).Name, strSearch, 1) < 0 Then
Workbooks(intTemp).Activate
Exit Sub
End If
Next
End Sub


If this post helps click Yes
---------------
Jacob Skaria


"Rob" wrote:

Hello. I'm trying to make another window active which will have the file
name of "WIPDrilldownExport(__).xls", where only one character appears in the
parentheses and could be a 1, 2, or 3. The line

Windows("WIPDrilldownExport(#).xls").Activate

doesn't work. Thanks in advance.

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
Using Wildcard to Activate & Rename Workbooks jake Excel Programming 0 June 5th 07 10:26 PM
Workbook.Activate / Window.Activate problem Tim[_44_] Excel Programming 3 February 3rd 06 11:38 PM
Activate an Excel spreadsheet using wildcard name Dennis Excel Programming 1 September 9th 04 01:44 AM
Activate new window Robert Rosenberg[_2_] Excel Programming 0 December 30th 03 04:46 PM
Activate new window Tom Ogilvy Excel Programming 0 December 30th 03 04:37 PM


All times are GMT +1. The time now is 05:19 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"