Hi zico8,

Originally Posted by
zico8
any comments?
I have tried to experiment a little and have looked a lot in Internet for info.
I do not have a complete answer for you. But I can tell you the following
This statement
Dim WB As Workbook
Assigns a variable for holding a Workbook object.
Now to your specific questions
_1) Set WB = Workbooks("myfile.xlsm")
This Sets the WB Object to a specific File, here the opened file "myfile.xlsm". SO THE FILE "myfile.xlsm" MUST ALREADY BE OPEN FOR THIS TO WORK.
_2) Set WB = Workbooks.Open(ThisWorkbook.path & "\myfile.xlsm")
This opens the Workbook "\myfile.xlsm" and sets the WB Object to this file "\myfile.xlsm". So the File must exist but does not have to be open. If it is open this code line will not error
_3) Set WB = GetObject(ThisWorkbook.path & "\myfile.xlsm")
This appears to do the same as _2) , Except the file is not visible. I have not been able to find a way to make this visible. So to manipulate it you must use VBA code. It is good practice to add a line to release the reference to this Object.
Hope that helps a bit.
And here is a code i used to test the above:
Alan
P.s. The further code below demonstrate how to do the “Performing a reference”, that is to say it gets data from a closed File without opening that File, as per your original request.
Bookmarks