Retrieving a variant type of SAFEARRAY

Retrieving a variant type as described in MSDN here: http://msdn.microsoft.com/en-us/library/ms221482(v=vs.85).aspx. Sometimes previous code returned incorrect type.