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
I found a Link to Harry Stegemans site and managed to use his macro for this purpose.
"Je bent echt wel een macro-crack, Harry! Bedankt voor de freeware!"
Jean-Paul,
Would you happen to have that link handy? I was trying to figure out a way to do that last week and never found a solution.
TIA!
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
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