'フォームを×で閉じさせない========================

Private Sub userform_queryclose(Cancel As Integer, CloseMode As Integer)

If CloseMode <> vbFormCode Then

MsgBox "[×]ボタンは使えません。" & Chr(10) & "終了ボタンを押してください。"

Cancel = 1
End If

End Sub
'---------------------------------------------------------------------------

 

'------------------Excel表示をしない

Private Sub Workbook_Open()

    Application.Visible = False
    UserForm2.Show vbModal  
  End Sub