Prioritypub
asked on
A macro command that will open an unknown file in a known folder?
I have an Excel file in a folder with a name that will often change. I need to open that file and copy contents from it to another Excel file. I have the macro written to perform all the tasks, except if I don't know what the name of the file will be when the macro is run, so how can I open it? It will be the only file in this folder, and the folder name will never change. Is there a command line that will rename the file (without knowing what that file name is) if I know the folder name?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Dim vFile As String
vFile = FirstFileName("C:\folderna
If Len(vFile) > 0 Then
Workbooks.Open vFile
End If
Matt