VBA Code to Open File Dialog in Excel

This code displays the Open File dialog box to select a file and returns the file path.

VBA Code:

Sub OpenFileDialog()
    Dim filePath As Variant
    
    filePath = Application.GetOpenFilename
    MsgBox "Selected File: " & filePath
End Sub

Check All VBA Codes

Join Our Telegram Group techguruplus telegram group Join Our WhatsApp Group techguruplus whatsapp group

Leave a Comment