File open with Path Name

R

rickey24

Hi

If you have the whole file path name (eg
C:\Pen\Data\Worlds\Global.xls) in Excel Cell B2, how do you call tha
in my macro with, for e.g.
Workbooks.opentext Filename:= B2. Is that possible? Thanks.

R
 
B

Bob Phillips

Workbooks.opentext Filename:= Activesheet.Range("B2").Value

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
R

rickey24

Thanks Bob!!

2 more additional questions, say I have a list of them all in that
column, how can I open up all of them. Also, I am Workbooks.add at the
beginning so it is no longer the activesheet anymore so I need to go
back to the original worksheet. Thanks again.

RH
 
B

Bob Phillips

Something like

Set oThis = Activeworkbook
cRows = Cells(Rows.Count,"B").End(xlUp).Row
For i = 2 To cRows
Workbooks.opentext Filename:= Activesheet.Cells(i,"B").Value
Next i

oThis.Activate

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Top