NessPJ
Active Member
- Joined
- May 10, 2011
- Messages
- 414
- Office Version
- 365
Hi all,
I am working on a project with a userform and it contains some data entry by the user, by the form of the barcode.
To show the user, the barcode they are dissecting (and give them some interactivity) i use the TextBox_Change routine posted below.
Though i noticed that this seems to make the unload of my Userform really slow! When i cut out the TextBoxInvoer_Change() subroutine the
cancel/unloading of the form is instantaneous again.
Is this a known thing to happen? Is there anything i can/should do to improve performance?
I am working on a project with a userform and it contains some data entry by the user, by the form of the barcode.
To show the user, the barcode they are dissecting (and give them some interactivity) i use the TextBox_Change routine posted below.
Though i noticed that this seems to make the unload of my Userform really slow! When i cut out the TextBoxInvoer_Change() subroutine the
cancel/unloading of the form is instantaneous again.
Is this a known thing to happen? Is there anything i can/should do to improve performance?
VBA Code:
Private Sub TextBoxInvoer_Change()
If InStr(1, TextBoxInvoer.Text, AppIDBatch) > 0 Then
BatchDetect = InStr(1, TextBoxInvoer.Text, AppIDBatch)
LabelBatchData.Caption = Mid(TextBoxInvoer.Text, BatchDetect + 4, BatchLength)
Else
LabelBatchData.Caption = ""
End If
If InStr(1, TextBoxInvoer.Text, AppIDTHT) > 0 Then
THTDetect = InStr(1, TextBoxInvoer.Text, AppIDTHT)
LabelTHTData.Caption = Mid(TextBoxInvoer.Text, THTDetect + 4, THTLength)
End If
If InStr(1, TextBoxInvoer.Text, AppIDSSCC) > 0 Then
SSCCDetect = InStr(1, TextBoxInvoer.Text, AppIDSSCC)
LabelSSCCData.Caption = Mid(TextBoxInvoer.Text, SSCCDetect + 4, SSCCLength)
End If
End Sub
Private Sub CancelButton_Click()
i = 5
Unload Me
Sheets("Menu").Activate
Sheets("Menu").Range("H5").ClearContents
Sheets("Menu").Range("H6").ClearContents
Sheets("Menu").Range("H8").ClearContents
Sheets("Menu").Range("H9").ClearContents
Sheets("Menu").Range("H11").ClearContents
Sheets("Menu").Range("H12").ClearContents
Sheets("Menu").Range("K5").ClearContents
Sheets("Menu").Range("K6").ClearContents
Sheets("Menu").Range("K8").ClearContents
Sheets("Menu").Range("K9").ClearContents
MsgBox "U heeft de bewerking afgebroken.", vbCritical, "Bewerking afgebroken"
End Sub