This is what I have working now:
Private SldApp As SldWorks.SldWorks Private WithEvents ThisModalDoc As SldWorks.DrawingDoc
Sub UserForm_Initialize() 'Form wants to be hidden, to be shown only when current doc is closed Me.Hide Set SldApp = Application.SldWorks
Sub DocStart() strCurrDoc = colSWDrawFiles(1) colSWDrawFiles.Remove (1) Set swDrawDoc = PartOpen(strCurrDoc, "SLDDRW") SldApp.ActivateDoc2 strCurrDoc, True, lngwarnings Set ThisModalDoc = SldApp.ActiveDoc 'Cant get this line to work - toolbars are inactive for some reason swDrawDoc.Toolbars True, False, True, True, False, False, False Call DelayTime(conDelay)
Part open is a function that uses : Set swModel = swApp.OpenDocSilent(strMyFile, _ swDocDRAWING, lngwarnings)
DelayTime is a sub containing: Dim Start As Double Start = Timer ' Set start time. Do While Timer < Start + T DoEvents ' Relinquish control to the processor Loop If blnDestroyed Then 'Document closed if true - set in ThisModalDoc_DestroyNotify() 'Show form as modal to stop code Me.Show Else 'Document is still open Call DelayTime(conDelay) End If
A button_Click event calls DocStart() all over again
This actually works pretty smoothly - in spite of being rather processor intensive. Only problem now is that my application toolbars are all de-activated for some reason.