+ Reply to Thread
Results 1 to 7 of 7

Err.number is not working

  1. #1
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Poland
    MS-Off Ver
    Excel 2016-365
    Posts
    2,940

    Err.number is not working

    Hi,

    my code:

    Please Login or Register  to view this content.
    Application.ExecuteExcel4Macro(name) is hidden space variable and it s assigned with the other macro.
    Here it is empty so this code will throw an error.

    ipath is set as Variant/error like here:
    problem.png

    but Err.Number is not working.
    How can I create here my error handler?

    Best Wishes,
    Jacek
    Last edited by 6StringJazzer; 12-08-2017 at 08:41 AM. Reason: Moved from Excel General

  2. #2
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Err.number is not working

    Maybe use Report Post (in your first post) to ask moderator to move your thread here: Excel Programming / VBA / Macros

  3. #3
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Poland
    MS-Off Ver
    Excel 2016-365
    Posts
    2,940

    Re: Err.number is not working

    If you want to use hidden space variable you can set up this as:

    Please Login or Register  to view this content.
    Could you please help me?

    Jacek

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Err.number is not working

    Quote Originally Posted by jaryszek View Post
    Err.Number is not working
    Please explain what "not working" means.
    • Does the code run?
    • Does it run but do nothing?
    • Does it produce error messages? If so, what do the messages say?
    • Does it produce unexpected/wrong results? If so, how do the results differ from what you expect?
    • Does it hang?

    It would help to see all of your code. To set up an error handler:
    Please Login or Register  to view this content.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  5. #5
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Err.number is not working

    Returning an error value is not the same as causing a run-time error. You need to use
    Please Login or Register  to view this content.
    to see if a valid value was returned. Or if you want a run-time error declare iPath as String.
    Last edited by xlnitwit; 12-08-2017 at 08:58 AM.
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  6. #6
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Poland
    MS-Off Ver
    Excel 2016-365
    Posts
    2,940

    Re: Err.number is not working

    Thank you !

    Code is running but if this code:

    name = "Path"

    My whole code:

    Please Login or Register  to view this content.
    err.number equals "0" here and my msgbox shoule be triggered and it is not...

    Thank you
    Jacek

  7. #7
    Forum Contributor
    Join Date
    01-16-2014
    Location
    Poland
    MS-Off Ver
    Excel 2016-365
    Posts
    2,940

    Re: Err.number is not working

    Thank you xlnitwit ! You are the boss!

    Best wishes,
    Jacek

+ 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. Replies: 11
    Last Post: 04-17-2012, 09:41 AM
  2. Working out a percentage if the number is above
    By Cmorgan in forum Excel - New Users/Basics
    Replies: 8
    Last Post: 03-07-2012, 02:46 AM
  3. Number formatting not working
    By oteixeira in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-14-2010, 07:01 AM
  4. Number range sub not working
    By hermithead in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-25-2010, 07:06 AM
  5. Working out the number of items in =1+2+3+4
    By inkymike in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-05-2006, 05:56 AM
  6. i'm trying to put a value with a number but its not working.
    By dave in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-09-2006, 12:10 AM
  7. i'm trying to put a value with a number but its not working.
    By dave in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-08-2006, 02:40 PM
  8. How to get number of working days
    By nougain in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-03-2006, 04:10 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