+ Reply to Thread
Results 1 to 7 of 7

Excel Crashes when adding code to workbook via VBA

  1. #1
    Valued Forum Contributor realniceguy5000's Avatar
    Join Date
    03-20-2008
    Location
    Fl
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    951

    Excel Crashes when adding code to workbook via VBA

    Hi Everyone,

    I thought I had this fixed late yesterday, But the same problem happened again this morning. This all generated from this post
    http://www.excelforum.com/excel-prog...ml#post2073179

    The code below resides in my personal.XLS Module. When I step through the code everything works till it reaches the point in red then I get the pop up that says excel needs to close and asks to send or not to send.

    I noticed that if I choose recover my work and restart excel and I look at the code in THISWORKBOOK of the recovered workbook that the code I wanted placed there is there.

    Can anyone explain why this is happening? I have the macro's security set to low and a check mark in the trust access to vb projects.

    Any Idea's how to fix this?

    Thank You again for your contiued support!!!
    Mike
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Cross posted to get a wider range of help
    http://www.mrexcel.com/forum/showthr...90#post1900890
    Last edited by realniceguy5000; 04-24-2009 at 01:11 PM. Reason: Change Code Entries to Links

  2. #2
    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: Excel Crashes when adding code to workbook via VBA

    Hello realniceguy5000,

    This macro is a little longer, but safer to use.
    Please Login or Register  to view this content.
    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!)

  3. #3
    Valued Forum Contributor realniceguy5000's Avatar
    Join Date
    03-20-2008
    Location
    Fl
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    951

    Re: Excel Crashes when adding code to workbook via VBA

    Quote Originally Posted by Leith Ross View Post
    Hello realniceguy5000,

    This macro is a little longer, but safer to use.
    Please Login or Register  to view this content.
    Hi Leith, I have finally finished my other project now I'm back to this one. I'm sorry but this will sound odd...
    But I am having trouble running your code. I'm not sure how to call your macro ?

    Here is what I have, But a couple question it will not let me call it because of the argument is not optional? also how does it know where my text file is located?

    Sorry, Mike

    Please Login or Register  to view this content.
    ]

  4. #4
    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: Excel Crashes when adding code to workbook via VBA

    Hello Mike,

    I have put the corrections in blue. The only optional argument is the boolean variable Overwrite. Set this to true if you want to overwrite the file's previously saved contents.

    The macro knows where the file is because it appears in your code. The full file path appears in your macro OpenALL(). The full path is given as "C:\Documents and Settings\MAlston\Desktop\Count Sheets\mycode.txt"
    Please Login or Register  to view this content.

  5. #5
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Excel Crashes when adding code to workbook via VBA

    I have the macro's security set to low ...
    RNG, that is an invitation to an ocean of heartbreak.
    Entia non sunt multiplicanda sine necessitate

  6. #6
    Valued Forum Contributor realniceguy5000's Avatar
    Join Date
    03-20-2008
    Location
    Fl
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    951

    Re: Excel Crashes when adding code to workbook via VBA

    Leith, Your a Genius...
    No problems with this working.You are a master in the world of code!!!!

    Thanks so much for your hard work!!!

    Mike,

  7. #7
    Valued Forum Contributor realniceguy5000's Avatar
    Join Date
    03-20-2008
    Location
    Fl
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    951

    Re: Excel Crashes when adding code to workbook via VBA

    Quote Originally Posted by shg View Post
    RNG, that is an invitation to an ocean of heartbreak.
    Dont worry Shg, I only set this to get this code to work as I was trying bunches of things. Levels are reset now.

    Thank You for the reminder though...Mike

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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