rfletcher35
Active Member
- Joined
- Jul 20, 2011
- Messages
- 300
- Office Version
- 365
- Platform
- Windows
Guys,
This must be a simple one but I cannot see what I am missing. My code is below, it open a prompt to choose a workbook that I extract data from. I need this workbook to be referenced later in my code. I am trying to reference it as wb1 but it does not work, can anyone see the issue please?
' Open Downloaded Data
Dim wb1 As Workbook
Dim fileNameAndPath As Variant
fileNameAndPath = Application.GetOpenFilename(FileFilter:="Excel Files (*.csv), *.csv", Title:="Select your Downloaded File")
If fileNameAndPath = False Then Exit Sub
Workbooks.Open Filename:=fileNameAndPath
Set wb1 = ActiveWorkbook
Thanks
Fletch
This must be a simple one but I cannot see what I am missing. My code is below, it open a prompt to choose a workbook that I extract data from. I need this workbook to be referenced later in my code. I am trying to reference it as wb1 but it does not work, can anyone see the issue please?
' Open Downloaded Data
Dim wb1 As Workbook
Dim fileNameAndPath As Variant
fileNameAndPath = Application.GetOpenFilename(FileFilter:="Excel Files (*.csv), *.csv", Title:="Select your Downloaded File")
If fileNameAndPath = False Then Exit Sub
Workbooks.Open Filename:=fileNameAndPath
Set wb1 = ActiveWorkbook
Thanks
Fletch