Home |
Search |
Today's Posts |
#1
|
|||
|
|||
Opening a file with a Macro
To open files with a macro, I am currently using:
Workbooks.Open Filename:= "C:\file_path.xls" How can I use a variable as part of the file path? In other words, before I try to open the file in my VBA code I will set a variable (let's call it date_extension). Then I want to open a file that I know will exist with a file path whose final characters before the .xls will be the date_extension. How can I get the file path to be recognized with the variable? Thanks for your help (P.S. I am a total novice, so I may not be familiar with commands or procedures that are fairly basic for you folks.) |
#2
|
|||
|
|||
The command would be
Workbooks.Open Filename:= "C:\file_path" & date_extension & ".xls" But is "file_path" the name of your file? That's usually a description of the directory tree. |
#3
|
|||
|
|||
worked great -- thanks!
"Dave O" wrote: The command would be Workbooks.Open Filename:= "C:\file_path" & date_extension & ".xls" But is "file_path" the name of your file? That's usually a description of the directory tree. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro warning (upon opening) | Excel Discussion (Misc queries) | |||
macro error when opening any file | Excel Discussion (Misc queries) | |||
Problem opening an XML file in Excel - getting "ns1:macrosPresent" | Excel Discussion (Misc queries) | |||
After deleting a macro, I still get the pop-up when opening file | Excel Worksheet Functions | |||
Macro did not run after download file from net | Excel Worksheet Functions |