Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default How can I open an Excel workbook using a cell containing the path and filename

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,588
Default How can I open an Excel workbook using a cell containing the path and filename

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default How can I open an Excel workbook using a cell containing the path and filename

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I display the filename and path in a cell? DianePDavies Excel Discussion (Misc queries) 9 June 30th 09 09:35 PM
Freeze filename and path in cell Constantly Questioning Excel Discussion (Misc queries) 2 October 29th 08 06:48 PM
how to insert the path and filename into cell in excel 2002 fuzzylinux Excel Discussion (Misc queries) 2 June 4th 08 09:24 PM
Insert picture from filename & path in sheet's cell Corey Excel Programming 1 August 14th 07 09:24 AM
Determining the full path and filename of an active workbook Aaron Dyck Excel Programming 1 August 31st 06 03:20 AM


All times are GMT +1. The time now is 05:53 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"