Consulting

Page 3 of 3 FirstFirst 1 2 3
Results 41 to 45 of 45

Thread: Python dictionary in VBA

  1. #41
    Quote Originally Posted by p45cal View Post
    Make it easy for us to help you, supply a workbook with where you've got to so far.
    Over here you have to change it to "Sheet1"
    Capture3.jpg
    Attached Files Attached Files

  2. #42
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,875
    Either:
    In the VBE, go to Tools|References… and tick Microsoft Scripting Runtime

    2023-03-27_142848.jpg

    or:
    change the lines:
    Dim rebars2  As Scripting.Dictionary
    Set rebars2 = New Scripting.Dictionary
    to:
    Dim rebars2  As Object
    Set rebars2 = CreateObject("Scripting.Dictionary")
    and change the line:
            lb.AddItem rebars2.Items(i) & " - " & rebars2.Keys(i)
    to:
            lb.AddItem rebars2.Items()(i) & " - " & rebars2.Keys()(i)
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

  3. #43
    Quote Originally Posted by p45cal View Post
    Either:
    In the VBE, go to Tools|References… and tick Microsoft Scripting Runtime

    Yep, i was missing that!
    2023-03-27_142848.jpg

    or:
    change the lines:
    Dim rebars2  As Scripting.Dictionary
    Set rebars2 = New Scripting.Dictionary
    to:
    Dim rebars2  As Object
    Set rebars2 = CreateObject("Scripting.Dictionary")
    and change the line:
            lb.AddItem rebars2.Items(i) & " - " & rebars2.Keys(i)
    to:
            lb.AddItem rebars2.Items()(i) & " - " & rebars2.Keys()(i)

  4. #44
    Quote Originally Posted by p45cal View Post
    Either:
    In the VBE, go to Tools|References… and tick Microsoft Scripting Runtime
    Yeah, i was missing that
    Could you explain, why do you need extra parentheses to line :
    lb.AddItem rebars2.Items()(i) & " - " & rebars2.Keys()(i)
    2023-03-27_142848.jpg

    or:
    change the lines:
    Dim rebars2  As Scripting.Dictionary
    Set rebars2 = New Scripting.Dictionary
    to:
    Dim rebars2  As Object
    Set rebars2 = CreateObject("Scripting.Dictionary")
    and change the line:
            lb.AddItem rebars2.Items(i) & " - " & rebars2.Keys(i)
    to:
            lb.AddItem rebars2.Items()(i) & " - " & rebars2.Keys()(i)

  5. #45
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,875
    Quote Originally Posted by Einsener37 View Post
    Could you explain, why do you need extra parentheses to line :
    I don't know, I just did a bit of research and that's what's needed if you use late binding (that is, if you're not using the Microsoft Scripting Runtime reference)

    ps, don't quote the whole post, I didn't notice at first that you'd added a question in among the quote.
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

Posting Permissions

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