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 select workbook

Hi,

I'm using a macro that opens a dialigbox to open a file.
I know the filename begins with ABC.
Fe 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 I select I use
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: 3,885
Default select workbook

Hi
you may try something like the following:
sub foo()
dim wbk as workbook
For each wbk in workbooks
if ucase(left(wbk.name,3))="ABC" then
wbk.activate
exit for
end if
next
end sub

-----Original Message-----
Hi,

I'm using a macro that opens a dialigbox to open a file.
I know the filename begins with ABC.
Fe 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 I select I use
Windows("DEF.xls").Activate

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

Thanks
Tom

.

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

Hi
Nothing happens, even no error.
Tom
-----Original Message-----
Hi
you may try something like the following:
sub foo()
dim wbk as workbook
For each wbk in workbooks
if ucase(left(wbk.name,3))="ABC" then
wbk.activate
exit for
end if
next
end sub

-----Original Message-----
Hi,

I'm using a macro that opens a dialigbox to open a file.
I know the filename begins with ABC.
Fe 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 I select I use
Windows("DEF.xls").Activate

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

Thanks
Tom

.

.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default select workbook

Hi
works for me (Excel 97). What is the exact code you have
used?

-----Original Message-----
Hi
Nothing happens, even no error.
Tom
-----Original Message-----
Hi
you may try something like the following:
sub foo()
dim wbk as workbook
For each wbk in workbooks
if ucase(left(wbk.name,3))="ABC" then
wbk.activate
exit for
end if
next
end sub

-----Original Message-----
Hi,

I'm using a macro that opens a dialigbox to open a file.
I know the filename begins with ABC.
Fe 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 I select I use
Windows("DEF.xls").Activate

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

Thanks
Tom

.

.

.

  #5   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default select workbook

I'm using Excell 2003

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

Exit For
End If
Next
Windows("Quogen NeXspan 1.0.xls").Activate


End Sub



-----Original Message-----
Hi
works for me (Excel 97). What is the exact code you have
used?

-----Original Message-----
Hi
Nothing happens, even no error.
Tom
-----Original Message-----
Hi
you may try something like the following:
sub foo()
dim wbk as workbook
For each wbk in workbooks
if ucase(left(wbk.name,3))="ABC" then
wbk.activate
exit for
end if
next
end sub

-----Original Message-----
Hi,

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

file.
I know the filename begins with ABC.
Fe 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 I select I use
Windows("DEF.xls").Activate

Can I use something like Windows

("ABC*.xls").Activate ?

Thanks
Tom

.

.

.

.



  #7   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default select workbook

Dave
problem is solved
you're right! Exp has to be EXP
Thank you very much !
Tom
-----Original Message-----
This line jumped out at me. (I didn't look at anything

else.)

If UCase(Left(wbk.Name, 3)) = "Exp" Then
Since you're checking uppercase stuff...
If UCase(Left(wbk.Name, 3)) = "EXP" Then



wrote:

I'm using Excell 2003

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

Exit For
End If
Next
Windows("Quogen NeXspan 1.0.xls").Activate


End Sub

-----Original Message-----
Hi
works for me (Excel 97). What is the exact code you

have
used?

-----Original Message-----
Hi
Nothing happens, even no error.
Tom
-----Original Message-----
Hi
you may try something like the following:
sub foo()
dim wbk as workbook
For each wbk in workbooks
if ucase(left(wbk.name,3))="ABC" then
wbk.activate
exit for
end if
next
end sub

-----Original Message-----
Hi,

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

file.
I know the filename begins with ABC.
Fe 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 I select I use
Windows("DEF.xls").Activate

Can I use something like Windows

("ABC*.xls").Activate ?

Thanks
Tom

.

.

.

.


--

Dave Peterson

.

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
How to select all worksheets in a workbook Faith Excel Discussion (Misc queries) 8 October 20th 08 09:12 PM
Select sheet tabs in workbook & save to separate workbook files stratocaster Excel Worksheet Functions 2 March 1st 06 03:35 PM
workbook select Nigel Excel Discussion (Misc queries) 3 May 17th 05 08:45 PM
Sheets select method fails when workbook is opened by another workbook Mike Excel Programming 2 June 8th 04 04:17 AM
Select other workbook to select data in a macro. T Tromp Excel Programming 2 September 19th 03 01:43 PM


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