ChDrive and ChDir


About how to change current drive and directory for selecting files or folders in Excel Open dialog box.

13.09.2022, Goran Dolenc
Categories: Excel VBA
Tags: ChDir ChDrive


Sub BrowseJobsMappingFile()
' select jobs mapping XLSX file

Dim ffile As Variant

ChDrive ThisWorkbook.Path
ChDir ThisWorkbook.Path
ffile = Application.GetOpenFilename("Sales XLSX File (*.xlsx*), *.xlsx*")
If ffile = "False" Then Exit Sub
Range("rngImportFile").Value = ffile

End Sub