PC Review


Reply
Thread Tools Rate Thread

How can I open an Excel workbook using a cell containing the path and filename

 
 
Denis
Guest
Posts: n/a
 
      18th Oct 2008
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
 
Reply With Quote
 
 
 
 
Tim Williams
Guest
Posts: n/a
 
      18th Oct 2008
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" <(E-Mail Removed)> wrote in message
news:Xns9B3B9D4B844F7Denis@69.16.185.247...
>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



 
Reply With Quote
 
Denis B.
Guest
Posts: n/a
 
      19th Oct 2008
Thanks Tim. Works like a charm. Such a short code too. Amazing.

Denis


"Tim Williams" <timjwilliams at gmail dot com> wrote in
news:(E-Mail Removed):

> 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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to insert the path and filename into cell in excel 2002 fuzzylinux Microsoft Excel Misc 2 4th Jun 2008 09:24 PM
Determining the full path and filename of an active workbook =?Utf-8?B?QWFyb24gRHljaw==?= Microsoft Excel Programming 1 31st Aug 2006 03:20 AM
Default File Path in Workbooks.Open(FileName:="Filename") =?Utf-8?B?RGVubmlz?= Microsoft Excel Misc 1 18th Oct 2004 04:53 PM
Add path and .xls to cell to produce filename claytorm Microsoft Excel Misc 2 23rd Aug 2004 01:44 AM
Path and filename in every Excel workbook =?Utf-8?B?QW5kcmVhcyBJbmRhaGw=?= Microsoft Excel Misc 7 11th Feb 2004 12:19 AM


Features
 

Advertising
 

Newsgroups
 


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