+ Reply to Thread
Results 1 to 11 of 11

Type Mismatch Runtime Error

  1. #1
    Registered User
    Join Date
    02-13-2014
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    16

    Type Mismatch Runtime Error

    Hi all,

    I seem to be getting a type mismatch error or the following line:

    Please Login or Register  to view this content.
    I am running this line in excel, trying to extract data from visio.

    I thought that a type mismatch error would mean that the name of the document is wrong. Is this right? Could it mean something else?

    Any advice would be appreciated.

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Type Mismatch Runtime Error

    Type mismatch doesn't mean that, if it was the wrong name the error would be more likely to be 'Subscript out of range'.

    Which application is giving the message, Visio or Excel?
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    02-13-2014
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    16

    Re: Type Mismatch Runtime Error

    Ah right. Excel. The code i'm trying to run is:

    Please Login or Register  to view this content.
    So the code should look at the Visio document thats already open, determine if a layer is visible or not, and change the value in a cell. When I step through, I get the error on the line in my OP.

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Type Mismatch Runtime Error

    Are you sure you need this line?

    Please Login or Register  to view this content.
    If Visio has a document open it's already the active Visio document.

    Try commenting out that line.

  5. #5
    Registered User
    Join Date
    02-13-2014
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    16

    Re: Type Mismatch Runtime Error

    I've taken it out and it removes the error. But now nothing happens at all. Any ideas why?

    Thanks for your help so far!

  6. #6
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Type Mismatch Runtime Error

    Have you tried stepping through the code with F8?

  7. #7
    Registered User
    Join Date
    02-13-2014
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    16

    Re: Type Mismatch Runtime Error

    Yep. It highlights each row then moves on to the next without doing anything.

    Actually, is doesn't highlight the if result:

    Please Login or Register  to view this content.
    Does this mean the if condition hasn't been met, and so won't run this line?

  8. #8
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Type Mismatch Runtime Error

    Yes, the if condition hasn't been meant, thought that be the problem.

    What is it you are trying to check there?

    Also, what is conVisible?

  9. #9
    Registered User
    Join Date
    02-13-2014
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    16

    Re: Type Mismatch Runtime Error

    It's trying to look at an open visio document and see if a layer (in this case Option02) is visible.

    Done!

    I was using the wrong property for the layers, but had no idea which to use. I finally managed to find it.

    The final code is as follows:

    Please Login or Register  to view this content.
    Thanks for all the help Norie!

  10. #10
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: Type Mismatch Runtime Error

    I think you must use:
    Please Login or Register  to view this content.
    if excelApp is valid Excel.Application object.
    • Please remember to mark threads Solved with Thread Tools link at top of page.
    • Please use code tags when posting code: [code]Place your code here[/code]
    • Please read Forum Rules

  11. #11
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Type Mismatch Runtime Error

    Jaeger

    Glad you got it working.

    I thought there was something missing there but it's been a long time since I've used VBA with Visio so wasn't sure what it was.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. RunTime Error 13: Type MIsmatch
    By tariq2 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-24-2013, 10:47 AM
  2. [SOLVED] runtime error 13 type mismatch
    By Justair07 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-28-2013, 02:46 PM
  3. Runtime Error Type Mismatch
    By hungryhobo in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-08-2013, 08:50 PM
  4. runtime error 13 type mismatch
    By hughesy8290 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-28-2013, 11:18 AM
  5. Runtime Error 13 - type mismatch
    By hindlehey in forum Excel General
    Replies: 1
    Last Post: 11-07-2005, 10:55 AM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1