Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a file folder with sequentially numbered filenames (1000.xls,
1001.xls...) I am trying to automate the opening and data extraction in the file by letting the user type in the filename number eg 1000 in a cell. In 2 cells I would put the file path in one cell and .xls in another. Finally I would concatenate all 3 cells to give me the path and filename of the file to open. I would put a button on the working sheet that would initiate the program that would open the file using the path/filename in the third cell where the path/filename/path was assembled. I figured out how to do the data extraction but I just can't figure out for the life of me how to get Workbook.Open to work using a cell address for the filename. There might be a much easier way to do this than what I came up with but I am just a newbie messing with this. I hope someone can help. Thanks, Denis |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Dim oWB as excel.workbook
set oWB=workbooks.open(sheet1.range("A1").value & _ sheet1.range("A2").value & ".xls") Where A1=path and A2=filename. Tim "Denis" wrote in message ... I have a file folder with sequentially numbered filenames (1000.xls, 1001.xls...) I am trying to automate the opening and data extraction in the file by letting the user type in the filename number eg 1000 in a cell. In 2 cells I would put the file path in one cell and .xls in another. Finally I would concatenate all 3 cells to give me the path and filename of the file to open. I would put a button on the working sheet that would initiate the program that would open the file using the path/filename in the third cell where the path/filename/path was assembled. I figured out how to do the data extraction but I just can't figure out for the life of me how to get Workbook.Open to work using a cell address for the filename. There might be a much easier way to do this than what I came up with but I am just a newbie messing with this. I hope someone can help. Thanks, Denis |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks Tim. Works like a charm. Such a short code too. Amazing.
Denis "Tim Williams" <timjwilliams at gmail dot com wrote in : Dim oWB as excel.workbook set oWB=workbooks.open(sheet1.range("A1").value & _ sheet1.range("A2").value & ".xls") Where A1=path and A2=filename. Tim Denis |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How do I display the filename and path in a cell? | Excel Discussion (Misc queries) | |||
Freeze filename and path in cell | Excel Discussion (Misc queries) | |||
how to insert the path and filename into cell in excel 2002 | Excel Discussion (Misc queries) | |||
Insert picture from filename & path in sheet's cell | Excel Programming | |||
Determining the full path and filename of an active workbook | Excel Programming |