When I submit a Form, it does everything that it is supposed to do, except that after it…
- User
When I submit a Form, it does everything that it is supposed to do, except that after it closes, I am getting a 'System Error &H80010007(-2147418105)'
Below are the codes from the sheet to call the form and the actual form code; CODE FROM THE SHEET: Sub CopyMatchingValues() Dim StaffForm As New StaffForm1 ' Show the UserForm as a modal dialog StaffForm.Show vbModal ' Check if UserForm was submitted or canceled If StaffForm.IsSubmitted Then ' Retrieve values from the UserForm Dim FullName As String Dim JobTitle As String Dim ContType As String Dim WorkHrs As String ' UserForm Values FullName = StaffForm.FullName.Text JobTitle = StaffForm.JobTitle.Text ContType = StaffForm.ContType.Text WorkHrs = StaffForm.WorkHrs.Text ' Copy values from the UserForm to 'OTForm' sheet ThisWorkbook.Sheets("OTForm").Range("B4").Value = FullName ThisWorkbook.Sheets("OTForm").Range("B7").Value = JobTitle ThisWorkbook.Sheets("OTForm").Range("E4").Value = ContType ThisWorkbook.Sheets("OTForm").Range("E5").Value = WorkHrs Else Exit Sub End If 'Call CopyMatchingContinue End Sub
CODE FROM THE FORM: Private mIsSubmitted As Boolean
Public Property Get IsSubmitted() As Boolean IsSubmitted = mIsSubmitted End Property
Private Sub StaffSubmit_Click() mIsSubmitted = True ' Check if all text boxes are filled If FullName.Text = "" Or JobTitle.Text = "" Or ContType.Text = "" Or WorkHrs.Text = "" Then MsgBox "Please fill in all the fields.", vbExclamation Exit Sub End If ' Copy values from text boxes to 'OTForm' sheet ThisWorkbook.Sheets("OTForm").Range("B4").Value = FullName.Text ThisWorkbook.Sheets("OTForm").Range("B7").Value = JobTitle.Text ThisWorkbook.Sheets("OTForm").Range("E4").Value = ContType.Text ThisWorkbook.Sheets("OTForm").Range("E5").Value = WorkHrs.Text ThisWorkbook.Sheets("OTForm").Range("B4").Calculate ThisWorkbook.Sheets("OTForm").Range("B7").Calculate ThisWorkbook.Sheets("OTForm").Range("E4").Calculate ThisWorkbook.Sheets("OTForm").Range("E5").Calculate ThisWorkbook.Sheets("OTFormX").Range("B4").Calculate ThisWorkbook.Sheets("OTFormX").Range("B7").Calculate ThisWorkbook.Sheets("OTFormX").Range("E4").Calculate ThisWorkbook.Sheets("OTFormX").Range("E5").Calculate ' Close the UserForm Unload Me End Sub
Private Sub StaffCancel_Click() mIsSubmitted = False ' Close the UserForm Me.Hide End Sub
- Assistant
The error message you're encountering ('System Error &H80010007(-2147418105)') is a runtime error known as "The callee (server [not server application]) is not available and disappeared; all connections are invalid. The call may have executed." This error usually occurs when there is a problem with the communication between the form and the Excel application.
Here are a few suggestions to help troubleshoot and resolve the issue:
-
Update your Office application: Make sure you have the latest updates and patches installed for your Office application. This can help fix any known issues or bugs in the software.
-