ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Opening file question (https://www.excelbanter.com/excel-programming/413825-opening-file-question.html)

Les

Opening file question
 
Hi all,

Is it possible to open a file if you only know part of the file name ?

For example, using a wild card. file name is
"Regressliste UX_01.06.08 To 30.06.08.xls" - The dates can vary so i would
only like to use "Regressliste UX *.xls", is this possible ??

Any help would be greatly appreciated.

--
Les

Mike H

Opening file question
 
Les,

try this

Sub standard()
getbook = True
Do
If getbook = True Then
Filename = Dir("c:\Book*.xls")' Change to suit
getbook = False
Else
Filename = Dir()
End If

If Filename < "" Then
Workbooks.Open Filename:=Filename
'Do something
End If
Loop While Filename < ""
End Sub

Mike

"Les" wrote:

Hi all,

Is it possible to open a file if you only know part of the file name ?

For example, using a wild card. file name is
"Regressliste UX_01.06.08 To 30.06.08.xls" - The dates can vary so i would
only like to use "Regressliste UX *.xls", is this possible ??

Any help would be greatly appreciated.

--
Les


Les

Opening file question
 
Thanks Mike H
--
Les


"Mike H" wrote:

Les,

try this

Sub standard()
getbook = True
Do
If getbook = True Then
Filename = Dir("c:\Book*.xls")' Change to suit
getbook = False
Else
Filename = Dir()
End If

If Filename < "" Then
Workbooks.Open Filename:=Filename
'Do something
End If
Loop While Filename < ""
End Sub

Mike

"Les" wrote:

Hi all,

Is it possible to open a file if you only know part of the file name ?

For example, using a wild card. file name is
"Regressliste UX_01.06.08 To 30.06.08.xls" - The dates can vary so i would
only like to use "Regressliste UX *.xls", is this possible ??

Any help would be greatly appreciated.

--
Les



All times are GMT +1. The time now is 01:28 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com