Catia VBA to .CATScript for type “Collection”

前端 未结 2 700
借酒劲吻你
借酒劲吻你 2021-01-24 15:37

In my VBA code i\'m using the following:

Dim docsToSave As Scripting.Dictionary
Set docsToSave = New Scripting.Dictionary

Dim toRemove As Collection
Set toRemov         


        
2条回答
  •  天涯浪人
    2021-01-24 16:03

    For the posted code to behave in the same way in VBScript as it would in VBA the following could be used:

    Dim docsToSave
    Set docsToSave = CreateObject("Scripting.Dictionary")
    
    Dim toRemove
    Set toRemove = CreateObject("Scripting.Dictionary")
    
    ...
    More Code
    ...
    
    For i = 0 To toRemove.Count - 1
        docsToSave.Remove (toRemove.keys()(i))
    Next
    

    Furthermore, to add to the Dictionary a different syntax is used compared to a Collection:

    'VBA-code for a collection:
    toRemove.Add (x)
    
    'VBScript for a dictionary:
    Call toRemove.Add(x, i)
    

    These changes were sufficient for me to have my VBA-script work in VBScript.

提交回复
热议问题