Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
TOM TOM is offline
external usenet poster
 
Posts: 47
Default activate unknown workbook

Hi,

I'm using a macro that opens a dialigbox to open a file.
I know the filename begins with ABC.
ex : ABC XXXXX of ABC YYYY.

Is it possible to switch between a filename that is
always the same and ABC XXXXX
The file I know (DEF) I select with :
Windows("DEF.xls").Activate

Can I use something like Windows("ABC*.xls").Activate ?

Thanks
Tom
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default activate unknown workbook

for each wkbk in Application.Workbooks
if Ucase(left(wkbk.Name,3)) = "ABC" then
wkbk.Activate
exit sub
end if
Next

--
Regards,
Tom Ogilvy

"Tom" wrote in message
...
Hi,

I'm using a macro that opens a dialigbox to open a file.
I know the filename begins with ABC.
ex : ABC XXXXX of ABC YYYY.

Is it possible to switch between a filename that is
always the same and ABC XXXXX
The file I know (DEF) I select with :
Windows("DEF.xls").Activate

Can I use something like Windows("ABC*.xls").Activate ?

Thanks
Tom



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default activate unknown workbook

And you have other replies to your other post.

Tom wrote:

Hi,

I'm using a macro that opens a dialigbox to open a file.
I know the filename begins with ABC.
ex : ABC XXXXX of ABC YYYY.

Is it possible to switch between a filename that is
always the same and ABC XXXXX
The file I know (DEF) I select with :
Windows("DEF.xls").Activate

Can I use something like Windows("ABC*.xls").Activate ?

Thanks
Tom


--

Dave Peterson

  #4   Report Post  
Posted to microsoft.public.excel.programming
TOM TOM is offline
external usenet poster
 
Posts: 47
Default activate unknown workbook

I'm using :
Sub test()
Dim wbk As Workbook
For Each wbk In Application.Workbooks
If UCase(Left(wbk.Name, 3)) = "Exp" Then
wbk.Activate
ActiveSheet.Unprotect
With ActiveWindow
.DisplayGridlines = True
.DisplayHeadings = True
End With
Columns("A:K").Select
Selection.EntireColumn.Hidden = False

Exit For
End If
Next
Windows("DEF.xls").Activate
End Sub

But it does nothing, even no error.

What's wrong

Thank you very much in advance !
Tom
-----Original Message-----
for each wkbk in Application.Workbooks
if Ucase(left(wkbk.Name,3)) = "ABC" then
wkbk.Activate
exit sub
end if
Next

--
Regards,
Tom Ogilvy

"Tom" wrote in

message
...
Hi,

I'm using a macro that opens a dialigbox to open a

file.
I know the filename begins with ABC.
ex : ABC XXXXX of ABC YYYY.

Is it possible to switch between a filename that is
always the same and ABC XXXXX
The file I know (DEF) I select with :
Windows("DEF.xls").Activate

Can I use something like Windows("ABC*.xls").Activate ?

Thanks
Tom



.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default activate unknown workbook

If UCase(Left(wbk.Name, 3)) = "Exp" Then

If UCase(Left(wbk.Name, 3)) = "EXP" Then

(ucase means upper case)



Tom wrote:

I'm using :
Sub test()
Dim wbk As Workbook
For Each wbk In Application.Workbooks
If UCase(Left(wbk.Name, 3)) = "Exp" Then
wbk.Activate
ActiveSheet.Unprotect
With ActiveWindow
.DisplayGridlines = True
.DisplayHeadings = True
End With
Columns("A:K").Select
Selection.EntireColumn.Hidden = False

Exit For
End If
Next
Windows("DEF.xls").Activate
End Sub

But it does nothing, even no error.

What's wrong

Thank you very much in advance !
Tom
-----Original Message-----
for each wkbk in Application.Workbooks
if Ucase(left(wkbk.Name,3)) = "ABC" then
wkbk.Activate
exit sub
end if
Next

--
Regards,
Tom Ogilvy

"Tom" wrote in

message
...
Hi,

I'm using a macro that opens a dialigbox to open a

file.
I know the filename begins with ABC.
ex : ABC XXXXX of ABC YYYY.

Is it possible to switch between a filename that is
always the same and ABC XXXXX
The file I know (DEF) I select with :
Windows("DEF.xls").Activate

Can I use something like Windows("ABC*.xls").Activate ?

Thanks
Tom



.


--

Dave Peterson



  #6   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default activate unknown workbook

problem is solved
Exp has to be EXP
Thx !
-----Original Message-----
I'm using :
Sub test()
Dim wbk As Workbook
For Each wbk In Application.Workbooks
If UCase(Left(wbk.Name, 3)) = "Exp" Then
wbk.Activate
ActiveSheet.Unprotect
With ActiveWindow
.DisplayGridlines = True
.DisplayHeadings = True
End With
Columns("A:K").Select
Selection.EntireColumn.Hidden = False

Exit For
End If
Next
Windows("DEF.xls").Activate
End Sub

But it does nothing, even no error.

What's wrong

Thank you very much in advance !
Tom
-----Original Message-----
for each wkbk in Application.Workbooks
if Ucase(left(wkbk.Name,3)) = "ABC" then
wkbk.Activate
exit sub
end if
Next

--
Regards,
Tom Ogilvy

"Tom" wrote in

message
.. .
Hi,

I'm using a macro that opens a dialigbox to open a

file.
I know the filename begins with ABC.
ex : ABC XXXXX of ABC YYYY.

Is it possible to switch between a filename that is
always the same and ABC XXXXX
The file I know (DEF) I select with :
Windows("DEF.xls").Activate

Can I use something like Windows

("ABC*.xls").Activate ?

Thanks
Tom



.

.

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
Activate new workbook with unknown name rt10516 Excel Discussion (Misc queries) 3 August 24th 05 05:40 AM
activate workbook w/unknown name Jim Cottrell Excel Discussion (Misc queries) 2 July 30th 05 12:31 AM
How to Activate unknown file name Ashley[_3_] Excel Programming 1 June 4th 04 06:41 PM
Activate Other Workbook pauluk[_37_] Excel Programming 16 April 20th 04 07:02 PM
Checking if workbook open (where path is unknown) [email protected] Excel Programming 0 September 4th 03 11:13 PM


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

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"