ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   File open with Path Name (https://www.excelbanter.com/excel-programming/303489-file-open-path-name.html)

rickey24[_8_]

File open with Path Name
 
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

--
Message posted from http://www.ExcelForum.com


Bob Phillips[_6_]

File open with Path Name
 
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)

"rickey24 " wrote in message
...
Hi

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

RH


---
Message posted from http://www.ExcelForum.com/




rickey24[_9_]

File open with Path Name
 
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


---
Message posted from http://www.ExcelForum.com/


Bob Phillips[_6_]

File open with Path Name
 
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)

"rickey24 " wrote in message
...
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


---
Message posted from http://www.ExcelForum.com/




rickey24[_10_]

File open with Path Name
 
Working like a charm, thanks Bob, your help was much appreciated.

R

--
Message posted from http://www.ExcelForum.com



All times are GMT +1. The time now is 12:33 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com