Yongan.Fu:
Declare Function mdlSheetDef_setBorderAttachmentId Lib "stdmdlbltin.dll"
(ByVal sheetDefIn As Long , ByVal borderAttachmentIdIn As DLong ) As Long
DLong is a VBA User Defined Type (UDT). UDTs must be passed ByRef. The MDL documentation for that VBA wrapper is incorrect.