Jaafar Tribak
Well-known Member
- Joined
- Dec 5, 2002
- Messages
- 9,596
- Office Version
- 2016
- Platform
- Windows
Hi all,
Does anybody know why VarType returns vbString when it should return vbObject ?
when assigning other objects to the variant variable other than "Application" , it seems to work as expected.
I have also tried Set v = Excel.Application and Set v = Application.Application but still no joy.
TypeName does work fine and returns Application as expected.
Am I missing something ?
Does anybody know why VarType returns vbString when it should return vbObject ?
VBA Code:
Sub Test()
Dim v As Variant
Set v = Application
MsgBox VarType(v) '<== returns 8(vbString) instead of 9(vbObject) !!
End Sub
when assigning other objects to the variant variable other than "Application" , it seems to work as expected.
I have also tried Set v = Excel.Application and Set v = Application.Application but still no joy.
TypeName does work fine and returns Application as expected.
Am I missing something ?