I just read lots of articles bout this error but could not handle how to solve it. the latest article was "INFO: Error or Unexpected Behavior with Office Automation When You Use Early Binding in Visual Basic" so I considered i need to do qualifying my code but i do not know how?!
here is the codes which I wrote on a excel vba userform:
Private Sub CommandButton1_Click()
Application.Calculation = False
Worksheets("Data Base").Activate
MSG1 = MsgBox("Do you want to submit the form?", vbYesNo)
If MSG1 = vbYes Then
Dim ssheet As Worksheet
Set ssheet = ThisWorkbook.Sheets("Data Base")
nr = ssheet.Cells(Rows.Count, 2).End(xlUp).Row + 1
ssheet.Cells(nr, 2) = Me.TextStockNo
ssheet.Cells(nr, 3) = Me.ComboRepName
ssheet.Cells(nr, 5) = Me.DTPickerDate
ssheet.Cells(nr, 6) = Me.TextYearModel
ssheet.Cells(nr, 7) = Me.ComboVehicleMake
ssheet.Cells(nr, 8) = Me.TextDescription
ssheet.Cells(nr, 9) = Me.TextRegNo
ssheet.Cells(nr, 9) = Me.TextMileage
ssheet.Cells(nr, 11) = Me.ComboColour
ssheet.Cells(nr, 12) = Me.TextBought
ssheet.Cells(nr, 13) = Me.TextSold
ssheet.Cells(nr, 15) = Me.ComboDealer
ssheet.Cells(nr, 16) = Me.ComboAdvert
ssheet.Cells(nr, 17) = Me.TextAddComments
ssheet.Cells(nr, 18) = Me.DTPickerInvoiceDate
ssheet.Cells(nr, 19) = Me.TextInvoiceNo
MSG2 = MsgBox("Do you want to input new field?", vbYesNo)
If MSG2 = vbYes Then
Unload Me
Worksheets("Data Base").Activate
userform1.Hide
userform1.Show
Else
Unload Me
End If
Else
Unload Me
Worksheets("Data Base").Activate
userform1.Hide
userform1.Show
End If
Application.Calculation = True
End Sub
Private Sub CommandButton2_Click()
Unload Me
End Sub
Private Sub CommandButton3_Click()
Unload Me
Worksheets("Data Base").Activate
userform1.Hide
userform1.Show
End Sub
Sub Open_Form()
Worksheets("Data Base").Activate
userform1.Show
End Sub
It is a data entry form which gives the user options to reset the form, submit or reload it. I it works fine at same time but as long as I submit for first time and reload it to submit next item it gives me that error.
I checked it on another pc and it works fine, I am not sure what is wrong with my pc.
Bookmarks