Macro to open Workbook in default path.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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.
 
Maybe this will help
Sub test()
MsgBox ThisWorkbook.Path & "\" & "workbook2name" & ".xls"
End Sub
 
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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top