Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 137
Default 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?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 618
Default 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?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,588
Default 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?



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 137
Default Selecting Workbooks

Thanks guys
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default 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
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Updating Workbooks from multiple links Workbooks TimJames Excel Worksheet Functions 1 December 15th 07 03:34 PM
Copy/ move selected data from workbooks to seperate worksheets or workbooks Positive Excel Worksheet Functions 1 August 30th 07 04:54 PM
Display 2 formulas from source workbooks to destination workbooks Excel_seek_help Excel Discussion (Misc queries) 4 April 27th 06 08:13 PM
suddenly my excel workbooks are "shared workbooks" Maggie's mom Excel Discussion (Misc queries) 1 August 28th 05 09:20 PM
Selecting Workbooks Sohpie Excel Programming 6 October 7th 04 02:04 PM


All times are GMT +1. The time now is 07:59 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"