I want just get the workbook name. Why VBA returns a error when i try use Workbook´s Name property directly, like this:
MsgBox "workbook name = " & Workbook.Name
The compiler says: Variable not declared. Workbook is an object. Why do i have to declare a variable associated to it?
MsgBox "workbook name = " & ThisWorkbook.Name MsgBox "workbook name = " & ActiveWorkbook.Name
Why do I have to use Application properties (ThisWorkbook and ActiveWorkbook) instead of Workbook.Name directly?
Workbook is not an object
Workbook is the
class which represents all the workbooks,
(for more details: http://www.functionx.com/vbaexcel/topics/workbooks.htm)
ThisWorkbook(or ActiveWorkbook) is the
classes don’t have values for properties (except static) .i.e. in other words, you cannot access
instance variables through a
i hope you understand.