I want to refer to a workbook (master.xlsx) in the same directory as the file containing the Excel VBA macro, without necessarily having to open it. [My basic understanding is that opening files is unnecessary so I would like to get into the good habit of not doing so, wherever possible.]
My first attempt was as below but it produced a type mismatch error on the 2nd ampersand symbol:
'
Dim master As Workbook
Set master = ThisWorkbook.Path & "" & "master.xlsx"
'
My second attempt (below) works fine but it opens the file.
'
Dim master As Workbook
Set master = Workbooks.Open(ThisWorkbook.Path & "" & "master.xlsx")
'
Can anyone advise on the best syntax to use please?
My first attempt was as below but it produced a type mismatch error on the 2nd ampersand symbol:
'
Dim master As Workbook
Set master = ThisWorkbook.Path & "" & "master.xlsx"
'
My second attempt (below) works fine but it opens the file.
'
Dim master As Workbook
Set master = Workbooks.Open(ThisWorkbook.Path & "" & "master.xlsx")
'
Can anyone advise on the best syntax to use please?