Empty keyword in statment Application.caption?
I was trying to learn from some code someone else had
written. What is the keyword Empty used for in the statement below. If I remove the "Empty &" the results seem to be the same. Is it just a placeholder of some kind? Application.Caption = empty & "Microsoft Excel (Alarm Set for " Application.Caption = "Microsoft Excel (Alarm Set for " |
Empty keyword in statment Application.caption?
Personally, I have found little in the help to indicate that "empty" is a
key word. If empty isn't declared as a variable or is declared as Variant and never initialized, then it would represent the value of an uninitialized variable. Used in the context you show, it would be equivalent to a null string, so it does nothing that I can see. -- Regards, Tom Ogilvy "Mel" wrote in message ... I was trying to learn from some code someone else had written. What is the keyword Empty used for in the statement below. If I remove the "Empty &" the results seem to be the same. Is it just a placeholder of some kind? Application.Caption = empty & "Microsoft Excel (Alarm Set for " Application.Caption = "Microsoft Excel (Alarm Set for " |
Empty keyword in statment Application.caption?
Empty is a keyword indicating that a Variant type variable has no
contents. E.g., Dim V As Variant Debug.Print V = Empty V = 123 Debug.Print V = Empty V = Empty Debug.Print V = Empty -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Tom Ogilvy" wrote in message ... Personally, I have found little in the help to indicate that "empty" is a key word. If empty isn't declared as a variable or is declared as Variant and never initialized, then it would represent the value of an uninitialized variable. Used in the context you show, it would be equivalent to a null string, so it does nothing that I can see. -- Regards, Tom Ogilvy "Mel" wrote in message ... I was trying to learn from some code someone else had written. What is the keyword Empty used for in the statement below. If I remove the "Empty &" the results seem to be the same. Is it just a placeholder of some kind? Application.Caption = empty & "Microsoft Excel (Alarm Set for " Application.Caption = "Microsoft Excel (Alarm Set for " |
Empty keyword in statment Application.caption?
substitute Horseradish for empty and see if you don't get the same result.
Sub Tester2() Dim V As Variant Debug.Print V = HorseRadish V = 123 Debug.Print V = HorseRadish V = HorseRadish Debug.Print V = HorseRadish End Sub gives the same result for me. If you have a reference, please post it. -- Regards, Tom Ogilvy "Chip Pearson" wrote in message ... Empty is a keyword indicating that a Variant type variable has no contents. E.g., Dim V As Variant Debug.Print V = Empty V = 123 Debug.Print V = Empty V = Empty Debug.Print V = Empty -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Tom Ogilvy" wrote in message ... Personally, I have found little in the help to indicate that "empty" is a key word. If empty isn't declared as a variable or is declared as Variant and never initialized, then it would represent the value of an uninitialized variable. Used in the context you show, it would be equivalent to a null string, so it does nothing that I can see. -- Regards, Tom Ogilvy "Mel" wrote in message ... I was trying to learn from some code someone else had written. What is the keyword Empty used for in the statement below. If I remove the "Empty &" the results seem to be the same. Is it just a placeholder of some kind? Application.Caption = empty & "Microsoft Excel (Alarm Set for " Application.Caption = "Microsoft Excel (Alarm Set for " |
Empty keyword in statment Application.caption?
From VBA's help in xl2002:
Empty The Empty keyword is used as a Variant subtype. It indicates an uninitialized variable value. It even turns blue like "if" and "then". Tom Ogilvy wrote: substitute Horseradish for empty and see if you don't get the same result. Sub Tester2() Dim V As Variant Debug.Print V = HorseRadish V = 123 Debug.Print V = HorseRadish V = HorseRadish Debug.Print V = HorseRadish End Sub gives the same result for me. If you have a reference, please post it. -- Regards, Tom Ogilvy "Chip Pearson" wrote in message ... Empty is a keyword indicating that a Variant type variable has no contents. E.g., Dim V As Variant Debug.Print V = Empty V = 123 Debug.Print V = Empty V = Empty Debug.Print V = Empty -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Tom Ogilvy" wrote in message ... Personally, I have found little in the help to indicate that "empty" is a key word. If empty isn't declared as a variable or is declared as Variant and never initialized, then it would represent the value of an uninitialized variable. Used in the context you show, it would be equivalent to a null string, so it does nothing that I can see. -- Regards, Tom Ogilvy "Mel" wrote in message ... I was trying to learn from some code someone else had written. What is the keyword Empty used for in the statement below. If I remove the "Empty &" the results seem to be the same. Is it just a placeholder of some kind? Application.Caption = empty & "Microsoft Excel (Alarm Set for " Application.Caption = "Microsoft Excel (Alarm Set for " -- Dave Peterson |
Empty keyword in statment Application.caption?
Since you're not using Option Explicit, VBA creates a new variant
variable called HorseRadish of subtype, yes, Empty (VarType() = vbEmpty =0). -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Tom Ogilvy" wrote in message ... substitute Horseradish for empty and see if you don't get the same result. Sub Tester2() Dim V As Variant Debug.Print V = HorseRadish V = 123 Debug.Print V = HorseRadish V = HorseRadish Debug.Print V = HorseRadish End Sub gives the same result for me. If you have a reference, please post it. -- Regards, Tom Ogilvy "Chip Pearson" wrote in message ... Empty is a keyword indicating that a Variant type variable has no contents. E.g., Dim V As Variant Debug.Print V = Empty V = 123 Debug.Print V = Empty V = Empty Debug.Print V = Empty -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Tom Ogilvy" wrote in message ... Personally, I have found little in the help to indicate that "empty" is a key word. If empty isn't declared as a variable or is declared as Variant and never initialized, then it would represent the value of an uninitialized variable. Used in the context you show, it would be equivalent to a null string, so it does nothing that I can see. -- Regards, Tom Ogilvy "Mel" wrote in message ... I was trying to learn from some code someone else had written. What is the keyword Empty used for in the statement below. If I remove the "Empty &" the results seem to be the same. Is it just a placeholder of some kind? Application.Caption = empty & "Microsoft Excel (Alarm Set for " Application.Caption = "Microsoft Excel (Alarm Set for " |
Empty keyword in statment Application.caption?
Or declaring it as a variant would achieve the same.
As Dave said, it is highlighted in Blue, so I guess VBA does see it as a keyword, but it seems of limited utility except for "documentation". -- Regards, Tom Ogilvy "Chip Pearson" wrote in message ... Since you're not using Option Explicit, VBA creates a new variant variable called HorseRadish of subtype, yes, Empty (VarType() = vbEmpty =0). -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Tom Ogilvy" wrote in message ... substitute Horseradish for empty and see if you don't get the same result. Sub Tester2() Dim V As Variant Debug.Print V = HorseRadish V = 123 Debug.Print V = HorseRadish V = HorseRadish Debug.Print V = HorseRadish End Sub gives the same result for me. If you have a reference, please post it. -- Regards, Tom Ogilvy "Chip Pearson" wrote in message ... Empty is a keyword indicating that a Variant type variable has no contents. E.g., Dim V As Variant Debug.Print V = Empty V = 123 Debug.Print V = Empty V = Empty Debug.Print V = Empty -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Tom Ogilvy" wrote in message ... Personally, I have found little in the help to indicate that "empty" is a key word. If empty isn't declared as a variable or is declared as Variant and never initialized, then it would represent the value of an uninitialized variable. Used in the context you show, it would be equivalent to a null string, so it does nothing that I can see. -- Regards, Tom Ogilvy "Mel" wrote in message ... I was trying to learn from some code someone else had written. What is the keyword Empty used for in the statement below. If I remove the "Empty &" the results seem to be the same. Is it just a placeholder of some kind? Application.Caption = empty & "Microsoft Excel (Alarm Set for " Application.Caption = "Microsoft Excel (Alarm Set for " |
All times are GMT +1. The time now is 09:57 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com