G
Guest
Excel Experts,
I want my code to open a file each morning but there will be extra unknown
characters at the end of the filename.
I believe I need to use a * to represent these, but I can't get the syntax
correct.
The file I want to open is:
C:\MyDocs\MC ID 101805C or
C:\MyDocs\MC ID 101805D
Without adjusting for the extra character, my code is similar to:
Sub OpenFile()
Dim strPath As String
Dim StrPrefix As String
Dim strDate As String
Const strPath As String = "C:\MyDocs\"
Const strPrefix As String = "MC ID "
strDate = Evaluate("=TODAY()")
strDate = Format(strDate, "mmddyy")
Workbooks.Open (strPath & strPrefix & strDate)
End Sub
I tried
Workbooks.Open (strPath & strPrefix & strDate & "*") , or
Workbooks.Open (strPath & strPrefix & strDate*)
but I'm missing something.
How would I modify the code to account for the extra character at the end?
Thanks in advance,
Alan
I want my code to open a file each morning but there will be extra unknown
characters at the end of the filename.
I believe I need to use a * to represent these, but I can't get the syntax
correct.
The file I want to open is:
C:\MyDocs\MC ID 101805C or
C:\MyDocs\MC ID 101805D
Without adjusting for the extra character, my code is similar to:
Sub OpenFile()
Dim strPath As String
Dim StrPrefix As String
Dim strDate As String
Const strPath As String = "C:\MyDocs\"
Const strPrefix As String = "MC ID "
strDate = Evaluate("=TODAY()")
strDate = Format(strDate, "mmddyy")
Workbooks.Open (strPath & strPrefix & strDate)
End Sub
I tried
Workbooks.Open (strPath & strPrefix & strDate & "*") , or
Workbooks.Open (strPath & strPrefix & strDate*)
but I'm missing something.
How would I modify the code to account for the extra character at the end?
Thanks in advance,
Alan