How can I read an attachaments slot number in VBA

I can change the slot number of an attachement in my reference dialog, but I can't find an attachement property that reads the slotnumber?!

Is there a simple way to do this?

I want to read data from my attachements in order of the slot numbers.

 

Jean-Paul

Parents
  • Hi Jean-Pual,

    Sorry for my delay response (I just read your post today). Please run my following snippet, it will get every reference's slot number by calling a MDL function.

    Declare Function mdlRefFile_getParameters Lib "stdmdlbltin.dll" (ByRef param As Long, ByVal paramName As Long, ByVal modelRef As Long) As Long
    Const REFERENCE_REFNUM As Integer = 28
    Sub GetRefSlot()
    Dim att As Attachment
    For Each att In ActiveModelReference.Attachments
       mdlRefFile_getParameters slot, REFERENCE_REFNUM, att.MdlModelRefP
       Debug.Print "AttachName = " & att.AttachName
       Debug.Print "AttachModelName = " & att.AttachModelName
       Debug.Print "Slot = " & slot
       Debug.Print "____________________________________________"
    Next
    End Sub

    HTH,

    Yongan Fu



Reply
  • Hi Jean-Pual,

    Sorry for my delay response (I just read your post today). Please run my following snippet, it will get every reference's slot number by calling a MDL function.

    Declare Function mdlRefFile_getParameters Lib "stdmdlbltin.dll" (ByRef param As Long, ByVal paramName As Long, ByVal modelRef As Long) As Long
    Const REFERENCE_REFNUM As Integer = 28
    Sub GetRefSlot()
    Dim att As Attachment
    For Each att In ActiveModelReference.Attachments
       mdlRefFile_getParameters slot, REFERENCE_REFNUM, att.MdlModelRefP
       Debug.Print "AttachName = " & att.AttachName
       Debug.Print "AttachModelName = " & att.AttachModelName
       Debug.Print "Slot = " & slot
       Debug.Print "____________________________________________"
    Next
    End Sub

    HTH,

    Yongan Fu



Children
  • Update for CONNECT Edition.
    According to API changes with migration from V8i to CONNECT Edition the function mdlRefFile_getParameters was replaced with new functions depending on the type of the return value.
    In this case of an int result, the function mdlRefFile_getIntegerParameters needs to be used in CE.
    Please see here the migrated code example for CONNECT Edition:

    Declare PtrSafe Function mdlRefFile_getIntegerParameters Lib "stdmdlbltin.dll" (ByRef value As Long, ByVal paramName As Long, ByVal modelRef As LongPtr) As Long
    
    Const REFERENCE_REFNUM As Integer = 28
    Sub GetRefSlot()
    Dim att As Attachment
    Dim slot As Long
    For Each att In ActiveModelReference.Attachments
       mdlRefFile_getIntegerParameters slot, REFERENCE_REFNUM, att.MdlModelRefP
       Debug.Print "AttachName = " & att.AttachName
       Debug.Print "AttachModelName = " & att.AttachModelName
       Debug.Print "Slot = " & slot
       Debug.Print "____________________________________________"
    Next
    End Sub
    

    Best regards,

    Artur