Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
variables for file names
I prompt a user to select the file they want. They do
this for three different files. I would like to create a variable with the file name only. That way, later in the program, I would like to refer to the appropriate workbook based on the file name they selected. For instance, I would like to do something like this: Workbooks (vFileName1).Activate or Workbooks (vFileName2).Close The variables I have created so far also contain the path. My variable looks like this: Workbooks (C:\MyDocs\File1.xls) Is it possible to create a variable with only the file name and not the entire path? Thanks for the help. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
variables for file names
Mike,
Dim Mypath, Myfile as String Mypath ="C:\MyDocs\" Myfile ="File1.xls" Workbooks (Mypath & Myfile).Activate or Workbooks (Mypath & Myfile).Close HTH Henry "mike" wrote in message ... I prompt a user to select the file they want. They do this for three different files. I would like to create a variable with the file name only. That way, later in the program, I would like to refer to the appropriate workbook based on the file name they selected. For instance, I would like to do something like this: Workbooks (vFileName1).Activate or Workbooks (vFileName2).Close The variables I have created so far also contain the path. My variable looks like this: Workbooks (C:\MyDocs\File1.xls) Is it possible to create a variable with only the file name and not the entire path? Thanks for the help. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Reference a file by concatenating cell variables | Excel Worksheet Functions | |||
find maximum and minum variables for multiple names | Excel Worksheet Functions | |||
BIG FILE LOTS of Variables that need to be counted | Excel Discussion (Misc queries) | |||
Inserting variables within file names | Excel Worksheet Functions | |||
Run a Batch file with variables | Excel Discussion (Misc queries) |