Figure out where it's crashing and then use a Try Catch block. If an exception fault happens, the Try Catch will skip over it and keep going.
You can also put a pcbdoc.transactionstart and transactionend in there, and put a second transactionend statement in the Catch area so that even if a failure happens in your transaction, it gets closed in the Catch and doesn't hang up Expedition like it would if an open transaction encounters a fatal error. Here's an example with both Try/Catch and Transaction:
'redraw the board outline
If doc.TransactionStart(0) = True Then
For Each shp In bo_mask.Shapes
ptary = shp.PointsArray
pts = UBound(ptary, 2) + 1
new_bo = doc.PutBoardOutline(pts, ptary, 0)
Catch ex As Exception
Debug.Print("creation of new board outline failed with an error message of " & ex.Message)
The ex variable initialized in the Catch statement has some additional functionality, such as ex.Message as used in the debug statement.
Of course if there is a failure you may want to alert the user in some way, exit the subroutine or function, or whatever else is needed to terminate the action cleanly without killing the application.