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?
|