+ Reply to Thread
Results 1 to 5 of 5

Dictionary

Hybrid View

Guest Dictionary 03-22-2005, 12:06 PM
Guest Re: Dictionary 03-22-2005, 12:06 PM
Guest Re: Dictionary 03-22-2005, 02:06 PM
Guest RE: Dictionary 03-22-2005, 01:06 PM
Guest RE: Dictionary 03-22-2005, 04:06 PM
  1. #1
    Jim Thomlinson
    Guest

    RE: Dictionary

    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


  2. #2
    Jac Tremblay
    Guest

    RE: Dictionary

    Hi Jim,
    You are quite right. I have to be more explicit in the declaration. I have
    to change this line as well:
    Set mdctDouble = New Scripting.Dictionary
    Thank you for your comment. It has been helpful.

    "Jim Thomlinson" wrote:

    > 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


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1