Not having two versions of Excel here to play with I can only speculate but
you could try a more explicit declaration
Private mdctDouble As Scripting.Dictionary
HTH
"Jac Tremblay" wrote:
> Hi,
> I want to use the dictionary to store unique values but it only works at the
> office where they use Excel XP. At home, with Excel 2003, the same code does
> not work. I get the error "Incorect use of keyword New". There is a reference
> to Microsoft Scripting Runtime at both places. What could be the problem?
> Here is the code:
> ' **********************************************************
> Option Explicit
> Private mdctDouble As Dictionary
> ' **********************************************************
> Private Sub TestDictionary()
> Set mdctDouble = New Dictionary
> MsgBox "Jac is already in the dictionary : " & IsDouble("Jac")
> MsgBox "Jac is already in the dictionary : " & IsDouble("Jac")
> Set mdctDouble = Nothing
> End Sub
> ' ***********************************************************
> Private Function IsDouble(ByRef rstrKey As String) As Boolean
> If mdctDouble.Exists(rstrKey) Then
> IsDouble = True
> Else
> mdctDouble.Add rstrKey, rstrKey
> IsDouble = False
> End If
> End Function
> ' ***********************************************************
> Thanks in advance.
> --
> Jac Tremblay
Bookmarks