Results 1 to 5 of 5
  1. #1
    2 Star Lounger
    Join Date
    May 2005
    Location
    Vancouver, Br. Columbia
    Posts
    223
    Thanks
    0
    Thanked 0 Times in 0 Posts

    ignoring all functions while macro is runnig (Excel 2000)

    Hi loungers,

    any one know a way I can ignore a function I have created when running a macro.

    The macro I am running saves the workbook.
    When saving the workbook the code always breaks because the macro jumps to a function i created and runs it reporting a Div/0 error.

    I would like to ignore the function while this macro runs so the code doesnt break and report an error Div/0

    Any ideas?

  2. #2
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: ignoring all functions while macro is runnig (Excel 2000)

    The macro would not just jump to another function. The macro would have to do something that is causing the function to run. It would have to call the cunction, or change a cell that caused a recalculate event which runs the function, or some other event that runs the function. We would have to know what was causing the function to run to know how to tell you to prevent it from running (if that is what you mean by "ignore the function."
    Legare Coleman

  3. #3
    2 Star Lounger
    Join Date
    May 2005
    Location
    Vancouver, Br. Columbia
    Posts
    223
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: ignoring all functions while macro is runnig (Excel 2000)

    ActiveWorkbook.SaveAs Filename:=sFinalfull

    when the code moves after the line above it it goes to the function. The function seems to be called up while saving

    sound like the probelm to you?

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: ignoring all functions while macro is runnig (Excel 2000)

    Does it help if you put

    Application.EnableEvents = False

    before the line that saves the workbook, and

    Application.EnableEvents = True

    after it?

  5. #5
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: ignoring all functions while macro is runnig (Excel 2000)

    Not necessarily. What is the function name (is it really a Function or is it a Sub)? Where is it located? Could you post a copy of the code and tell us where it gets the error?

    Hans' suggestion would probably stop it from executing, but I hesitate to do that without knowing what is not going to be done and why it is getting the error. It might be better to fix the cause of the error.
    Legare Coleman

Posting Permissions

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