+ Reply to Thread
Results 1 to 4 of 4

Error when Writing code by macro

  1. #1
    Forum Contributor
    Join Date
    09-30-2009
    Location
    Barcelona
    MS-Off Ver
    Excel 2010
    Posts
    274

    Error when Writing code by macro

    Hi,

    this might be a bit over-the-edge, but it's driving me crazy.
    I have a macro that creates a file with a toolbar, and thus it adds the code for the bar to appear and disappear when de workbook is activated/deactivated etc.

    this macro works beautifully, but I in some instances it does produce an error which makes excel to crash entirely.

    Has anyone experience in writing code in "thisworkbook" by ".insertlines"

    any way to prevent the error or at least see what is causing it to crash?

    thank you very much indeed

    should I change then default vbproject name to avoid conflicts??

    With the debugger I see that the macro does copy standard modules and even userforms, it crashes at the point in which it writes the first process in "Thisworkbook"

    any help will be welcome
    Last edited by bagullo; 04-10-2012 at 10:14 AM. Reason: completeness

  2. #2
    Valued Forum Contributor
    Join Date
    03-23-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    1,093

    Re: Error when Writing code by macro

    Hello Bagullo,

    Have you tried putting on error resume next or an errorhandler within your code?

  3. #3
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Error when Writing code by macro

    Hello bagullo,

    I have done this many times without crashing Excel. It would help if you post the post that is causing the problem.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  4. #4
    Forum Contributor
    Join Date
    09-30-2009
    Location
    Barcelona
    MS-Off Ver
    Excel 2010
    Posts
    274

    Re: Error when Writing code by macro

    Hi,

    I have tried putting an error handler, but the problem persists -- as mentioned, when the error happens the whole excel crashes, not just showing the debugger

    and here is the code where the error happens

    the thing is that the code DOES work perfectly in all other 99% of times -- just checking what can be causing such an error

    Please Login or Register  to view this content.
    Any clues on what can I try ?

    sometimes it works fine the first time and then does not work again for a while... but today didn't work even on a fresh attempt first thing in the morning :S

    this is confusing!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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