Error Checking in Excel
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 8 of 8

Thread: Problems running macro VBA

  1. #1
    New Member
    Join Date
    Jul 2005
    Posts
    36
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Problems running macro VBA

    I have the following problem:

    I received an Excel file with VBA macro. It runs when pressing the macro button. When I save the file, close it and re-open, it crashes when pressing the macro button. If I then close, re-open and now first save (before running the macro), I can run the macro successfully.

    The colleague who wrote the macro, can run it under all circumstances. With other colleagues, for some it works, for others it doesn't.

    Does anybody know what could cause this?

  2. #2
    MrExcel MVP Jonmo1's Avatar
    Join Date
    Oct 2006
    Location
    Bryan, TX
    Posts
    44,054
    Post Thanks / Like
    Mentioned
    18 Post(s)
    Tagged
    0 Thread(s)

    Default

    1. We'll probably need to see the code to help.
    2. Describe "Crashes". What exactly happens? Does it give an error? What error? Do you have a Debug Option when it errors? What line is highlighted...

    3. Without knowing the above information, Best guess is a Difference in Excel Versions between you and your coleague(s).
    Use the MrExcel HTML Maker to post nicely formatted tables in your forum posts.
    Find a link in post number 31

    The more we learn, and the better we get at our trade, the easier it becomes to overlook the obvious.

    Life moves pretty fast. If you don't stop and look around once in a while, you could miss it.
    Ferris Bueller A.K.A. John Hughes, 1986

  3. #3
    Board Regular brian.wethington's Avatar
    Join Date
    Jul 2006
    Location
    Irving TX
    Posts
    1,739
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Without having seen any code, the line the code erros on, or the error message the possiblities are endless.
    Brian

    Start by doing what's necessary; then do what's possible; and suddenly you are doing the impossible.
    St. Francis of Assisi

  4. #4
    New Member
    Join Date
    Jul 2005
    Posts
    36
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    crash:
    Microsoft Office Excel has encountered a problem and needs to close. We are sorry for the inconvenience.

    AppName: excel.exe AppVer: 11.0.8146.0 AppStamp:46a45966
    ModName: unknown ModVer: 0.0.0.0 ModStamp:00000000
    fDebug: 0 Offset: 00000000

    Automation Error Exception occurred.

    Automation error (Error 440)

  5. #5
    MrExcel MVP Jonmo1's Avatar
    Join Date
    Oct 2006
    Location
    Bryan, TX
    Posts
    44,054
    Post Thanks / Like
    Mentioned
    18 Post(s)
    Tagged
    0 Thread(s)

    Default

    Are your Windows/Excel Versions the Same umong all users?


    Try this, don't run the macro from the button...

    Open the VBE Window (ALT + F11)

    find the macro and put cursor at the beginning of that macro.
    Press F8 - This will step through the macro 1 line at a time. Make note of which line causes the Crash..

    Again, would be helpful to see the code...
    Use the MrExcel HTML Maker to post nicely formatted tables in your forum posts.
    Find a link in post number 31

    The more we learn, and the better we get at our trade, the easier it becomes to overlook the obvious.

    Life moves pretty fast. If you don't stop and look around once in a while, you could miss it.
    Ferris Bueller A.K.A. John Hughes, 1986

  6. #6
    New Member
    Join Date
    Jul 2005
    Posts
    36
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    When stepping through the code in the debugger (with F8), it simply runs through without any problems.

  7. #7
    MrExcel MVP Jonmo1's Avatar
    Join Date
    Oct 2006
    Location
    Bryan, TX
    Posts
    44,054
    Post Thanks / Like
    Mentioned
    18 Post(s)
    Tagged
    0 Thread(s)

    Default

    One more time...to Quote Jerry McGuire...

    "Help Me Help You!!!"

    Can you show us the code please??


    How are you starting the macro, from Tools - Macro - Macros...or with a shortcut key?
    Use the MrExcel HTML Maker to post nicely formatted tables in your forum posts.
    Find a link in post number 31

    The more we learn, and the better we get at our trade, the easier it becomes to overlook the obvious.

    Life moves pretty fast. If you don't stop and look around once in a while, you could miss it.
    Ferris Bueller A.K.A. John Hughes, 1986

  8. #8
    New Member
    Join Date
    Jul 2009
    Posts
    3
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Problems running macro VBA

    I am having this exact same problem. I get the same error message. Here are the steps that recreate the error in my workbook.

    I open excel and enable macros. My macro automatically runs and opens a userform. When I close the userform the following code runs

    Application.ActiveWorkbook.Save
    If Application.Workbooks.count > 1 Then
    ActiveWorkbook.Close
    Application.DisplayAlerts = False
    Else
    Application.Quit
    Application.DisplayAlerts = False
    End If

    Excel then closes. When I reopen the file I get the exact error mentioned in the previous posts.

    If I comment out the Application.ActiveWorkbook.Save line I do not get the error. What is it about saving that causes this problem and how can I fix this?

    Any help you can provide will be greatly appreciated.

    Thanks so much.

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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