Consulting

Results 1 to 5 of 5

Thread: Runtime Error 13: Type Mismatch

  1. #1
    VBAX Mentor
    Joined
    Aug 2020
    Location
    Hampshire
    Posts
    325
    Location

    Runtime Error 13: Type Mismatch

    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.
    Attached Files Attached Files

  2. #2
    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
    Graham Mayor - MS MVP (Word) 2002-2019
    Visit my web site for more programming tips and ready made processes
    http://www.gmayor.com

  3. #3
    VBAX Mentor
    Joined
    Aug 2020
    Location
    Hampshire
    Posts
    325
    Location
    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?

  4. #4
    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.
    Graham Mayor - MS MVP (Word) 2002-2019
    Visit my web site for more programming tips and ready made processes
    http://www.gmayor.com

  5. #5
    VBAX Mentor
    Joined
    Aug 2020
    Location
    Hampshire
    Posts
    325
    Location
    Thanks for the prompt Graham!

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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •