PDA

View Full Version : [SOLVED:] Runtime Error 13: Type Mismatch



HTSCF Fareha
10-22-2021, 10:16 AM
Having searched the above error on Google, the articles are for Excel and nothing that I could find for Word. I'm guessing the reason that this error is popping up will be the same, but I just cannot fathom out what I need to tweak to get it running.

The bold text shows where this is happening.


.Show
If .Tag = 0 Then GoTo lbl_Exit

Attached the document in question.

I'd be really grateful for some help.

gmayor
10-22-2021, 08:55 PM
Change the userform code subs below as follows:


'Cancel button
Private Sub cmdCancel_Click()
Hide
Tag = 0 'add this
lbl_Exit:
Exit Sub
End Sub

Private Sub cmdExecute_Click()
Tag = 1 'change this
Hide
lbl_Exit:
Exit Sub
End Sub

HTSCF Fareha
10-23-2021, 02:39 AM
As ever, many thanks to you Graham!

I just need to sort out the uppercase on the suspect part.

It might just be me but the execution time feels slightly slower than usual once the 'Enter' button is pressed?

gmayor
10-23-2021, 03:09 AM
It must be you, as it is fairly quick here :) - do however set the Enter button enabled property to false so that it is not enabled when the form first appears.

HTSCF Fareha
10-23-2021, 08:51 AM
Thanks for the prompt Graham!

Everything sorted now and a reboot sorted out the speed issue. Don't you just love Windows!