ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Opening a Workbook (https://www.excelbanter.com/excel-programming/290298-opening-workbook.html)

matt

Opening a Workbook
 
I'm trying to write a subroutine that opens a saved
workbook that resides in the same directory of my active
workbook, so that I can pull data from worksheets in that
workbook. My subroutine looks like this:

Sub Try()
Workbooks.Open "saved workbook"
End Sub

When I run this, however, i get an error saying that the
workbook cannot be found. I tried using the full path and
anf file extensions as well, but no luck. Has anyone run
into this problem as well?

Bob Phillips[_6_]

Opening a Workbook
 
Matt,

Try

ChDir Activeworkbook.Path

beforehand

--

HTH

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

"Matt" wrote in message
...
I'm trying to write a subroutine that opens a saved
workbook that resides in the same directory of my active
workbook, so that I can pull data from worksheets in that
workbook. My subroutine looks like this:

Sub Try()
Workbooks.Open "saved workbook"
End Sub

When I run this, however, i get an error saying that the
workbook cannot be found. I tried using the full path and
anf file extensions as well, but no luck. Has anyone run
into this problem as well?




matt

Opening a Workbook
 
Bob,

That did it.

Thanks!

Matt
-----Original Message-----
Matt,

Try

ChDir Activeworkbook.Path

beforehand

--

HTH

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

"Matt" wrote in

message
...
I'm trying to write a subroutine that opens a saved
workbook that resides in the same directory of my active
workbook, so that I can pull data from worksheets in

that
workbook. My subroutine looks like this:

Sub Try()
Workbooks.Open "saved workbook"
End Sub

When I run this, however, i get an error saying that the
workbook cannot be found. I tried using the full path

and
anf file extensions as well, but no luck. Has anyone run
into this problem as well?



.



All times are GMT +1. The time now is 08:10 PM.

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