Early binding to late binding

Programming and macros
User avatar
mp3-250
Posts: 630
Joined: Tue Sep 28, 2021 4:09 am
Answers: 20
Location: Japan
x 704
x 347

Early binding to late binding

Unread post by mp3-250 »

It seems that I cannot run this snippet within my PDM TASK macro even with "PDMWorks Enterprise 2023 Type Library" enabled in the VBA references in Solidworks, but it works correctly when debugged with Debug.Asserts False uncommented.

This task script is a patchwork and some parts related to pdm are already written as late binding, while the snipped below is derived from some code written as early binding...
I am not sure this is the problem, but if I comment the snippet the pdm task runs without crashing, so the problem is likely there.

I would like to convert this snippet from early binding to late binding, and try to run in our pdm sandbox again.
anyone could help me?

Code: Select all

Sub GetLocalCopies(vFilePaths As Variant)
    
	Dim pdmBatchGetUtil As EdmLib.IEdmBatchGet
	Set pdmBatchGetUtil = Vault.CreateUtility(EdmUtil_BatchGet)


    Dim pdmSelItems() As EdmLib.EdmSelItem
    ReDim pdmSelItems(UBound(vFilePaths))
    
    Dim filePath As String
    filePath = vFilePaths(0)
    
    Dim pdmFile As EdmLib.IEdmFile5
    Dim pdmFolder As EdmLib.IEdmFolder5
    
    Set pdmFile = Vault.GetFileFromPath(filePath, pdmFolder)
    
    pdmSelItems(0).mlDocID = pdmFile.ID
    pdmSelItems(0).mlProjID = pdmFolder.ID
   

    
    pdmBatchGetUtil.AddSelection Vault, pdmSelItems
    
    pdmBatchGetUtil.CreateTree 0, 32
    
    
    pdmBatchGetUtil.GetFiles 0


End Sub
Post Reply