Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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. -- Richard |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Maybe this will help
Sub test() MsgBox ThisWorkbook.Path & "\" & "workbook2name" & ".xls" End Sub "Richard" wrote: 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. -- Richard |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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) "Richard" wrote in message ... 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. -- Richard |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Run a macro when I open a workbook | Excel Discussion (Misc queries) | |||
Default a workbook to save as a xlsm (macro-enabled) in 2007 | Excel Discussion (Misc queries) | |||
How to Run Macro in open workbook/s | Excel Discussion (Misc queries) | |||
run macro on workbook open | Excel Discussion (Misc queries) | |||
how can I run a macro when I open a workbook? | Excel Discussion (Misc queries) |