View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
William Benson William Benson is offline
external usenet poster
 
Posts: 121
Default open workbook using wildcard

Hi, here is one solution perhaps, pls read the comment lines...

Sub OpenWild()
Dim Wk As Workbook
Dim WkToOpen As String

Set Wk = ActiveWorkbook

'Have stored the path in range PathLastSaved and
'Have stored the changing characters in range Dynamic_Characters
'Prefix and Suffix shown below are for example only

WkToOpen = _
Range("PathLastSaved").Cells(1, 1).Value _
& "Prefix_" _
& Range("Dynamic_Characters").Cells(1, 1).Value _
& "_Suffix.xls"
On Error Resume Next
Workbooks.Open Filename:=WkToOpen

On Error GoTo 0
End Sub


"Ben" wrote in message
...
Hello, I'd like a line of code to open a workbook whose middle characters
change daily. The first 4 characters remain constant. Let's say the first
four characters of the file are "data" and this info is in a cell named
"sourcefile". Can I use wildcards for the rest of the filename with
WORKBOOKS.OPEN FILENAME
Thank you