troubleshooting Question

VBA Excel - Open file with path

Avatar of csehz
csehzFlag for Hungary asked on
Microsoft Excel
2 Comments1 Solution335 ViewsLast Modified:
Dear Experts,

I have a short attached code which prompt an Open file window letting file selection, after opens that file.

Could you please advise is it possible that relating the path the macro would propose a certain one? For example Y:\Public\Daily would be my target, and the user would browse further

Sub OpenFile()
Dim Sourcefile
Sourcefile = Application.GetOpenFilename(Title:="Open downloadfile from SAP")
    If Sourcefile = False Then
        Exit Sub
    End If
Dim FileNameWorkbook As Workbook
Set FileNameWorkbook = Workbooks.Open(Sourcefile)
End Sub

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros