The following subroutine fails when a second user attaches to the
source drawings; It fails to create the memory set. This ONLY occurs
after the second (or more) user has attached source drawings.
Sub fSaveBckNewObjects(objId As Long, dwgName As String)
Dim poMapApp As AcadMap
Dim poPrj As AutocadMAP.Project
Dim poDset As DrawingSet
Dim poADwg As AttachedDrawing
Dim pbRet As Boolean
Dim lngIDArray(0) As Long
Dim strDwg As String
strDwg = "MAPS:\" & dwgName & ".dwg"
Set poMapApp =
ThisDrawing.Application.GetInterfaceObject("AutoCADMap.Application")
Set poPrj = poMapApp.Projects(ThisDrawing) 'current project document
Set poADwg = poPrj.DrawingSet.Item(strDwg) 'first attached drawing
lngIDArray(0) = objId
poPrj.SaveSet.AddObjects lngIDArray
Dim pvNew As Variant
pvNew = poPrj.SaveSet.GetObjects(kNewlyCreated)
pbRet = poADwg.SaveNewObjs(pvNew)
If pbRet Then
MsgBox ("Saved to memory")
Else
MsgBox ("Failed to save to memory")
End If
pbRet = poADwg.Save 'commit to attched drawing
If pbRet Then
MsgBox ("Saved to " & strDwg)
Else
MsgBox ("Failed to saveback to " & strDwg)
End If
End Sub