Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA code to open and copy a file
Is there a way to take the date entered by the user in cell C6 and write code
to: 1) go find the file name that contains that date 2) open that file 3) copy it to a new worksheet in the original workbook Thanks all for any suggestions. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA code to open and copy a file
If you search by date alone, you could possibly return several files with
that date as part of the file name. If you can narrow the search to files in only one folder the probability of many files being returned is reduced, but there still could be more than one. If you have the date and another piece of the file name or even if the date is at the beginning or end of the file name it would help to home in on the file. The rest is textbook operation. "Tbone" wrote: Is there a way to take the date entered by the user in cell C6 and write code to: 1) go find the file name that contains that date 2) open that file 3) copy it to a new worksheet in the original workbook Thanks all for any suggestions. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA code to open and copy a file
JLGWhiz,
The file will always be in a defined location and will have the same name only the date will change each week. An example would be C:\Employees\Active\ Current_01-29-07.xls I would like for once the user types in the date, in this case the user would type 1/29/07, the code would go to the C drive, find the file ending in that same date (there will only be one) and open it, then bring a copy back to the original workbook. How would I do that? "JLGWhiz" wrote: If you search by date alone, you could possibly return several files with that date as part of the file name. If you can narrow the search to files in only one folder the probability of many files being returned is reduced, but there still could be more than one. If you have the date and another piece of the file name or even if the date is at the beginning or end of the file name it would help to home in on the file. The rest is textbook operation. "Tbone" wrote: Is there a way to take the date entered by the user in cell C6 and write code to: 1) go find the file name that contains that date 2) open that file 3) copy it to a new worksheet in the original workbook Thanks all for any suggestions. |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA code to open and copy a file
Hi Tbone,
Dim DateName As String DateName = Range("C6").Value Workbooks.Open FileName:= _ "C:\Employees\Active\ Current_" & DateName & ".xls" Alan "Tbone" wrote in message ... Is there a way to take the date entered by the user in cell C6 and write code to: 1) go find the file name that contains that date 2) open that file 3) copy it to a new worksheet in the original workbook Thanks all for any suggestions. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
open file with code | Excel Discussion (Misc queries) | |||
How to Open a file with the help of a code in Excel | New Users to Excel | |||
Code to Open Excel File Please Help | Excel Discussion (Misc queries) | |||
How to open a zip file from the code? | Excel Programming | |||
VBA code to open file? | Excel Programming |