For other variable types, seeAbout Variable Types Excel(Excel) Macro(VBA).
First, we will explain the basic usage of the variable type "Workbook".
How to use Workbook
Use "Workbook" to store Workbooks.
The difference from other variables is that when storing in an object such as a workbook, "Set" is added to the beginning of the line.
Sub Workbook Usage()
Dim tb As Workbook
Set tb = ThisWorkbook
MsgBox tb.name
End Sub
When I run this code

was displayed.
Dim tb As Workbook" to declare that "tb" is a workbook, and
With "Set tb = ThisWorkbook", "tb" contains the book in which the macro is being executed.
MsgBox tb.name" displays the file name of workbook "tb" in a message box.
This ".name" part is called a property.
Workbook" has properties and methods.
Workbook Properties and Methods
Workbook" has properties and methods. By using these properties and methods, you can open and close a book, get a file name, get and specify the name of the folder where the book is saved, and do many other things.
The "Workbook" properties and methods are explained in a little more detail in the blog below.
How to use the property of variable type "Workbook" Excel (Excel) Macro (VBA)
How to use the method of variable type "Workbook" Excel (Excel) Macro (VBA)
Comment