shahin
Active Member
I've created a script in vba to open an excel file using Application.GetOpenFilename(). When I execute the script, it does lead me to that exact location but can't open that file. I'm only after the method I'm on to. How can I make it successful?
Address to the .xlsx file "C:\Users\WCS\Desktop\files\coworking\demo.xlsx"
This is I've written so far:
Address to the .xlsx file "C:\Users\WCS\Desktop\files\coworking\demo.xlsx"
This is I've written so far:
Code:
Sub OpenFile()
Dim fileName$
ChDir "C:\Users\WCS\Desktop\files\coworking"
fileName = Application.GetOpenFilename("demo(*.xlsx),*.xlsx")
If fileName <> "False" Then
Workbooks.Open fileName
End If
End Sub