View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Alan Beban[_2_] Alan Beban[_2_] is offline
external usenet poster
 
Posts: 783
Default To declare or not to declare

Tom Ogilvy wrote:

#Const CaseSensitive = True
#If CaseSensitive Then
Dim x As Dictionary
Set x = New Dictionary
#Else
Dim x As Collection
Set x = New Collection
#End If

But the compiler constant CaseSensitive is not the same as the variable
casesensitive.

Thanks.

The choices seem to be something like the above, Dim x As Object, or
don't declare x. In this specific case, what's really wrong with the
third choice (which certainly streamlines the code, at least from a
visual standpoint)? And what are the advantages of something like the
above rather than Dim x As Object?

Thanks,
Alan Beban