Results 1 to 14 of 14
  1. #1
    Lounger
    Join Date
    Mar 2004
    Posts
    42
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Macro Crashing (Word 2002)

    I have written a macro that I had no trouble with, until recently when I tried to improve it by adding, in its entirety, another macro that also had worked well on its own into the end of macro #1, to get a bigger macro. I use this macro repeatedly. A lot of the time (5 x in a row, say), it works just fine, but the macro will crash at some point, sometimes the second time in the session, always at the same point, just before the macro ends, when it is supposed to go to the end of a document. (it doesn't do that). I've removed all old ~normal.dots from my hard drive, and rebooted, etc. Can macros get too big? Anyone have any thoughts?

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

    Re: Macro Crashing (Word 2002)

    There is a limit, but it's pretty high. Have you tried calling macro#2 at the end of macro#1? You can do that by simply using the name of the macro as an instruction.

    Sub macro1()
    ...
    ' original code of macro1
    ...
    macro2
    End Sub

    BTW, you haven't told us what error message you get.

  3. #3
    Lounger
    Join Date
    Mar 2004
    Posts
    42
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Macro Crashing (Word 2002)

    Thanks for answering. No error message is generated: I simply see that horrid "microsoft word must close," which it does. It offers to send an analysis to Microsoft. When I permit it to, the reply is that I should run the upgrade, but I am always anxious of upgrading Word; I 've been writing Macros since Word 2.0, and some of them have slid by with their WordBasic commands intact, and little intervention from me, so I'm always afraid of the whole rickety structure collapsing with an upgrade. I then let it recover the document, and proceed. Then I close without saving the new "normal.dot" and I scour around for other temp files and try to get rid of them, then restart. Then the macro usually runs a few times, seamlessly, then Word decides to close down, always at the same point in the macro. I hope this makes sense.

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

    Re: Macro Crashing (Word 2002)

    Have you tried my suggestion, and if so, what was the result?

  5. #5
    Lounger
    Join Date
    Mar 2004
    Posts
    42
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Macro Crashing (Word 2002)

    Hans, I am going to set it up. Are you saying that multiple small, called macros are more stable than one big one? I have reworked the Macro itself, but have nothing on which to test it. I will need until Monday to start using the Macro; it needs some "work" to work on, which I generate during the 5 working days of the week only. I will let you know either way. Thanks so much for your time so far.
    Yours,
    Arlene

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

    Re: Macro Crashing (Word 2002)

    I'm not sure it will work, it's just something to test. An other thing you might try is to create a third macro that just calls macro1 and macro2:

    Sub macro3()
    macro1
    macro2
    End Sub

    (this might have the advantage of releasing memory used by macro1 before starting macro2)

    If these suggestions don't work, you might post the line of code on which the macro crashes (since you state that it is always at the same point), preferably with a few of the lines above and below it. Good luck!

  7. #7
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: Macro Crashing (Word 2002)

    Another thing worth trying is to export the modules and forms from your template/document and import them into a new one. I have seen Word macros with inexplicable behaviour that was fixed this way - I think that the modules can build up a legacy of deleted items in some way, but I'm not really sure.

    StuartR

  8. #8
    Lounger
    Join Date
    Mar 2004
    Posts
    42
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Macro Crashing (Word 2002)

    That's an idea, Stuart. I've got so many little pesky macros hanging around it might take forever for me to reconstruct a new normal. But I'll test it. Thanks. I'll let you know next week.
    Arlene

  9. #9
    Lounger
    Join Date
    Mar 2004
    Posts
    42
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Macro Crashing (Word 2002)

    Hans, I was very hopeful first thing this Am. The two linked macros ran 8 times without a hitch. I wasn't counting last week, but that feels like much more than what I had been getting. However, once Word had to (regretfully) Close, it began to close down every 2 times or so. I tried to look at the error report it wanted to send to Microsoft, but it was very long, and I was unable to highlight it to copy it, also, PrintScreen would not work on it, so I can try to copy it by hand and type it in and send it to you if you think that would help.

    Any other ideas?
    Thanks for all your help so far.
    Arlene

  10. #10
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Los Angeles Area, California, USA
    Posts
    7,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Macro Crashing (Word 2002)

    As an adjunct to what Stuart suggested, you might go Template Bloat & download Code Cleaner. See if that helps.
    Cheers,

  11. #11
    Lounger
    Join Date
    Mar 2004
    Posts
    42
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Macro Crashing (Word 2002)

    Thanks Phil. This might be the answer. It may take me a couple of days to get this accomplished, I'll post as soon as I'm done and tested. Thanks!
    Arlene

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

    Re: Macro Crashing (Word 2002)

    Please don't bother copying the error report by hand! There is usually little or no information in it that can be understood by mere mortals. I would follow up on Stuart's and Phil's suggestions.

  13. #13
    Lounger
    Join Date
    Mar 2004
    Posts
    42
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Macro Crashing (Word 2002)

    I tried using the Macro Cleaner from the template bloat. It did shrink down my Normal.dot from 1200 kB to about 940. However, the same problem kept happening. In frustration (I did have work to do), I decided to split off the portion of the macro that wasn't working, and just order it to run separately myself. Still crashed at end of Macro part 2 (I had split it into 3 parts). Then I moved a process from end of part 2 to begining of part 3, redefined a few variables, and tada...I ran it about 14 times without a glich. So tonight I have put the command back in to start Part 2 and Part 3 finishes, and I have my fingers crossed for that. Long way of saying the fix Hans suggested a few emails back was right, I just had split it up wrong...I had split off the part that was supposed to happen after the crash as a separate macro. But I think what was causing the problem was the last process, which looked as if it ran, and did indeed run, but caused the crashing as it's finale. So with that big memory user (it opens a big file and adds info to it) safe at the beginning of its own private macro, I seem to be ok. I'm going to run it for about 3 days, and I'll let you know for sure. But thanks, you guys, it's been great just knowing you were helping me!!
    Arlene

  14. #14
    Lounger
    Join Date
    Mar 2004
    Posts
    42
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Macro Crashing (Word 2002)

    I ran it 17 times today, without a hitch! I thank you so much.
    Arlene

Posting Permissions

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