Wednesday, January 15, 2014

VBA - Opening another workbook via a prompt

A snipet of code I use to have a user open files I want my MACRO to get data out of:


vFile = Application.GetOpenFilename("Excel-files,*", _
        1, "Select the file you want to open", , False)
'if the user didn't select a file, exit sub
If TypeName(vFile) = "Boolean" Then Exit Sub
Workbooks.Open vFile, UpdateLinks:=xlUpdateLinksAlways

No comments:

Post a Comment