Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 295
Default Referring to a variable file name

With Bob Phillips help I can create a variable filename. The filename is
contained in a cell called Filename_Finance. When I try to activate the
window I can't make it work. I've tried the following code:

Windows.Range("Filename_Finance").Activate
Windows(Range("Filename_Finance")).Activate
Workbooks.Range("Filename_Finance").Activate
Workbooks(Range("Filename_Finance")).Activate

but none of these work. When using the workbooks option I was mindful to add
the .xls.

Can someone help please?

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,593
Default Referring to a variable file name

Try

Activesheet.Range("Filename_Finance").Activate

if the sheet with that range is not yet activated, you have to activate it
first.

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Brettjg" wrote in message
...
With Bob Phillips help I can create a variable filename. The filename is
contained in a cell called Filename_Finance. When I try to activate the
window I can't make it work. I've tried the following code:

Windows.Range("Filename_Finance").Activate
Windows(Range("Filename_Finance")).Activate
Workbooks.Range("Filename_Finance").Activate
Workbooks(Range("Filename_Finance")).Activate

but none of these work. When using the workbooks option I was mindful to
add
the .xls.

Can someone help please?



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default Referring to a variable file name

I put Book2 in cell E9 and gave it the name
FILENAME_FINANCE
I made sure Book2.xls was already open and ran:

Sub brettjg()
Workbooks(Range("FILENAME_FINANCE").Value).Activat e
End Sub

and it ran just fine.

Must make sure the argument to Workbooks is a string and not a range.
--
Gary's Student
gsnu200708


"Brettjg" wrote:

With Bob Phillips help I can create a variable filename. The filename is
contained in a cell called Filename_Finance. When I try to activate the
window I can't make it work. I've tried the following code:

Windows.Range("Filename_Finance").Activate
Windows(Range("Filename_Finance")).Activate
Workbooks.Range("Filename_Finance").Activate
Workbooks(Range("Filename_Finance")).Activate

but none of these work. When using the workbooks option I was mindful to add
the .xls.

Can someone help please?

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 295
Default Referring to a variable file name

Thanks again Bob

"Bob Phillips" wrote:

Try

Activesheet.Range("Filename_Finance").Activate

if the sheet with that range is not yet activated, you have to activate it
first.

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Brettjg" wrote in message
...
With Bob Phillips help I can create a variable filename. The filename is
contained in a cell called Filename_Finance. When I try to activate the
window I can't make it work. I've tried the following code:

Windows.Range("Filename_Finance").Activate
Windows(Range("Filename_Finance")).Activate
Workbooks.Range("Filename_Finance").Activate
Workbooks(Range("Filename_Finance")).Activate

but none of these work. When using the workbooks option I was mindful to
add
the .xls.

Can someone help please?




  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 295
Default Referring to a variable file name

Thanks again GS. Bob replied with a solution as well, so I'll try them both
when I finish the current task. I'm putting the finishing touched on a
ridiculously complex suite of books that create up to five loan applications
and all the paperwork that goes with them in about 10 minutes. It's a blast,
but a pain in the neck at the minute!!

"Gary''s Student" wrote:

I put Book2 in cell E9 and gave it the name
FILENAME_FINANCE
I made sure Book2.xls was already open and ran:

Sub brettjg()
Workbooks(Range("FILENAME_FINANCE").Value).Activat e
End Sub

and it ran just fine.

Must make sure the argument to Workbooks is a string and not a range.
--
Gary's Student
gsnu200708


"Brettjg" wrote:

With Bob Phillips help I can create a variable filename. The filename is
contained in a cell called Filename_Finance. When I try to activate the
window I can't make it work. I've tried the following code:

Windows.Range("Filename_Finance").Activate
Windows(Range("Filename_Finance")).Activate
Workbooks.Range("Filename_Finance").Activate
Workbooks(Range("Filename_Finance")).Activate

but none of these work. When using the workbooks option I was mindful to add
the .xls.

Can someone help please?

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
variable file names Brettjg Excel Discussion (Misc queries) 2 March 2nd 07 10:56 AM
referring to a cell containing a file name [email protected] Excel Discussion (Misc queries) 2 December 4th 06 05:03 PM
Variable File Name [email protected] Excel Worksheet Functions 1 June 18th 06 10:36 AM
Inport from a variable file name shikamikamoomoo Excel Discussion (Misc queries) 1 March 22nd 06 12:29 AM
open file (as variable) from macro d chaps Excel Discussion (Misc queries) 1 March 14th 05 11:57 PM


All times are GMT +1. The time now is 08:52 AM.

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"