Selecting Workbooks
After getting the user to select the file to open by:
fName = Application.GetOpenFilename Workbooks.Open Filename:=fName Any idea how can i refer to this workbook again later on in my code? |
Selecting Workbooks
Hi Darren
as long as you don't redefine fName Workbooks(fName).Activate or Workbooks(fName).Sheets("Sheet1").Select etc Cheers JulieD "Darren" wrote in message ... After getting the user to select the file to open by: fName = Application.GetOpenFilename Workbooks.Open Filename:=fName Any idea how can i refer to this workbook again later on in my code? |
Selecting Workbooks
dim wb as workbook
fName = Application.GetOpenFilename set wb=workbooks.open(fName) Tim "Darren" wrote in message ... After getting the user to select the file to open by: fName = Application.GetOpenFilename Workbooks.Open Filename:=fName Any idea how can i refer to this workbook again later on in my code? |
Selecting Workbooks
Thanks guys
|
Selecting Workbooks
Watch out.
fName will include the drive\path when it comes back from .getopenfilename. You could strip the drive\path out of the string, or use a variable like Tim suggested. JulieD wrote: Hi Darren as long as you don't redefine fName Workbooks(fName).Activate or Workbooks(fName).Sheets("Sheet1").Select etc Cheers JulieD "Darren" wrote in message ... After getting the user to select the file to open by: fName = Application.GetOpenFilename Workbooks.Open Filename:=fName Any idea how can i refer to this workbook again later on in my code? -- Dave Peterson |
All times are GMT +1. The time now is 02:14 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com