Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a variable filename in a cell. The cell, K6, contains "
concatenate(K4,H4)" I recorded a macro that opens "filename" using Workbooks.Open FileName:= "filename" but the filename is hard coded as the name when the macro was recorded, not a variable name. How do I get the macro to open the variable filename in K6? I am not a VB programmer. I tried Workbooks.Open FileName:= (K6) but either it isn't the right way to do it or the syntax is bad. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Try
Workbooks.Open FileName:= Sheets("Sheet 1").Range("K6").value Where "Sheet 1" is the tab name of the sheet containing the file name. -- HTH... Jim Thomlinson "Steve@ABS" wrote: I have a variable filename in a cell. The cell, K6, contains " concatenate(K4,H4)" I recorded a macro that opens "filename" using Workbooks.Open FileName:= "filename" but the filename is hard coded as the name when the macro was recorded, not a variable name. How do I get the macro to open the variable filename in K6? I am not a VB programmer. I tried Workbooks.Open FileName:= (K6) but either it isn't the right way to do it or the syntax is bad. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Workbooks.Open FileName:=Range("K6").Value
"Steve@ABS" wrote: I have a variable filename in a cell. The cell, K6, contains " concatenate(K4,H4)" I recorded a macro that opens "filename" using Workbooks.Open FileName:= "filename" but the filename is hard coded as the name when the macro was recorded, not a variable name. How do I get the macro to open the variable filename in K6? I am not a VB programmer. I tried Workbooks.Open FileName:= (K6) but either it isn't the right way to do it or the syntax is bad. |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks, that works. Now I have a similar problem switching between open
worksheets: Windows ("H33").Activate where H33 is the name of the worksheet we opened in K6 minus the path. "K Dales" wrote: Workbooks.Open FileName:=Range("K6").Value "Steve@ABS" wrote: I have a variable filename in a cell. The cell, K6, contains " concatenate(K4,H4)" I recorded a macro that opens "filename" using Workbooks.Open FileName:= "filename" but the filename is hard coded as the name when the macro was recorded, not a variable name. How do I get the macro to open the variable filename in K6? I am not a VB programmer. I tried Workbooks.Open FileName:= (K6) but either it isn't the right way to do it or the syntax is bad. |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Same principle
Windows (Range("H33").Value).Activate -- HTH Bob Phillips "Steve@ABS" wrote in message ... Thanks, that works. Now I have a similar problem switching between open worksheets: Windows ("H33").Activate where H33 is the name of the worksheet we opened in K6 minus the path. "K Dales" wrote: Workbooks.Open FileName:=Range("K6").Value "Steve@ABS" wrote: I have a variable filename in a cell. The cell, K6, contains " concatenate(K4,H4)" I recorded a macro that opens "filename" using Workbooks.Open FileName:= "filename" but the filename is hard coded as the name when the macro was recorded, not a variable name. How do I get the macro to open the variable filename in K6? I am not a VB programmer. I tried Workbooks.Open FileName:= (K6) but either it isn't the right way to do it or the syntax is bad. |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Workbooks.Open FileName:= Range("K6").Value
-- HTH Bob Phillips "Steve@ABS" wrote in message ... I have a variable filename in a cell. The cell, K6, contains " concatenate(K4,H4)" I recorded a macro that opens "filename" using Workbooks.Open FileName:= "filename" but the filename is hard coded as the name when the macro was recorded, not a variable name. How do I get the macro to open the variable filename in K6? I am not a VB programmer. I tried Workbooks.Open FileName:= (K6) but either it isn't the right way to do it or the syntax is bad. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro to open most recent file with a particular filename string | Excel Discussion (Misc queries) | |||
set filename to <filename-date on open | Excel Worksheet Functions | |||
Put Filename Variable in Macro | Excel Discussion (Misc queries) | |||
Macro to open SaveAs... and change filename to cell value | Excel Programming | |||
Can a MACRO prompt for the filename to open and/or save? | Excel Programming |