D
Dave Ramage
Greg, try this:
Sub demo()
Dim strPath As String
Dim wbW As Workbook
'get path and name of workbook containing macro
strPath = ThisWorkbook.FullName
'extract path only
strPath = Left(strPath, InStrRev(strPath, "\"))
'open another workbook to this folder:
Set wbW = Workbooks.Open(strPath & "MyBook.xls")
End Sub
Note that if the workwork containing the code has not been
saved yet then the second strPath statement will return ""
and you'll get an error openning the workbook.
Cheers,
Dave.
Sub demo()
Dim strPath As String
Dim wbW As Workbook
'get path and name of workbook containing macro
strPath = ThisWorkbook.FullName
'extract path only
strPath = Left(strPath, InStrRev(strPath, "\"))
'open another workbook to this folder:
Set wbW = Workbooks.Open(strPath & "MyBook.xls")
End Sub
Note that if the workwork containing the code has not been
saved yet then the second strPath statement will return ""
and you'll get an error openning the workbook.
Cheers,
Dave.