Macro to open Workbook in default path.

R

Richard

OS: MS XP
Excel: 2002

I have (2) two workbooks in the same directory. One workbook opens the other.
The (2) two workbooks will always be together in the same directory but on
occasions the directory will change.

Is there a way in a macro to always use the path of workbook “A†to open
workbook “B�

Thanks in advance.
 
M

Mike

Maybe this will help
Sub test()
MsgBox ThisWorkbook.Path & "\" & "workbook2name" & ".xls"
End Sub
 
C

Chip Pearson

Richard,

Try something like

Dim PathA As String
PathA = Workbooks("BookA.xls").Path
Workbooks.Open Filename:=PathA & "\" & "BookB.xls"


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting
www.cpearson.com
(email on the web site)
 
Top