Create a workbook property named "AllowClose" or something to that effect. The workbook simply will not allow closing unless this property equals True. Make it so from the userform. See the example...
ALLOWCLOSE_FROMUSERFORM.zip
<table width="100%" border="1" bgcolor="White" style="filter
rogid:DXImageTransform.Microsoft.Gradient(endColorstr='#C0CFE2', startColorstr='#FFFFFF', gradientType='0');"><tr><TD><font size="2" face=Courier New> <font color="#008000">'in thisworkbook</font>
<font color="#0000A0">Private</font> pAllowClose <font color="#0000A0">As</font> <font color="#0000A0">Boolean</font>
<font color="#0000A0">Friend</font> <font color="#0000A0">Property</font> <font color="#0000A0">Get</font> AllowClose() <font color="#0000A0">As</font> <font color="#0000A0">Boolean</font>
AllowClose = pAllowClose
<font color="#0000A0">End</font> <font color="#0000A0">Property</font>
<font color="#0000A0">Friend</font> <font color="#0000A0">Property</font> <font color="#0000A0">Let</font> AllowClose(ByVal vNewValue <font color="#0000A0">As</font> Boolean)
pAllowClose = vNewValue
<font color="#0000A0">End</font> <font color="#0000A0">Property</font>
<font color="#0000A0">Private</font> <font color="#0000A0">Sub</font> Workbook_Open()
pAllowClose = <font color="#0000A0">False</font>
<font color="#0000A0">End</font> <font color="#0000A0">Sub</font>
<font color="#0000A0">Private</font> <font color="#0000A0">Sub</font> Workbook_BeforeClose(Cancel <font color="#0000A0">As</font> Boolean)
Cancel = <font color="#0000A0">Not</font> pAllowClose
<font color="#0000A0">End</font> <font color="#0000A0">Sub</font>
<font color="#008000">'is userform</font>
<font color="#0000A0">Private</font> <font color="#0000A0">Sub</font> CommandButton1_Click()
Unload Me
ThisWorkbook.AllowClose = <font color="#0000A0">True</font>
<font color="#008000"> 'you should determine if other workbooks are open before</font>
<font color="#008000"> 'simply closing the entire application</font>
Application.Quit
<font color="#0000A0">End</font> <font color="#0000A0">Sub</font>
</FONT></td></tr></table><button onclick='document.all("9720064714328").value=document.all("9720064714328").value.replace(/<br \/>\s\s/g,"");document.all("9720064714328").value=document.all("9720064714328").value.replace(/<br \/>/g,"");window.clipboardData.setData("Text",document.all("9720064714328").value);'>Copy to Clipboard</BUTTON><textarea style="position:absolute;visibility:hidden" name="9720064714328" wrap="virtual">
'in thisworkbook
Private pAllowClose As Boolean
Friend Property Get AllowClose() As Boolean
AllowClose = pAllowClose
End Property
Friend Property Let AllowClose(ByVal vNewValue As Boolean)
pAllowClose = vNewValue
End Property
Private Sub Workbook_Open()
pAllowClose = False
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Cancel = Not pAllowClose
End Sub
'is userform
Private Sub CommandButton1_Click()
Unload Me
ThisWorkbook.AllowClose = True
'you should determine if other workbooks are open before
'simply closing the entire application
Application.Quit
End Sub</textarea>