+ Reply to Thread
Results 1 to 15 of 15

Macro crashes from time to time when running from another computer

  1. #1
    Valued Forum Contributor
    Join Date
    08-29-2011
    Location
    Mississauga, CANADA
    MS-Off Ver
    Excel 2010
    Posts
    503

    Macro crashes from time to time when running from another computer

    I have developed a Macro in excel 2010 that runs perfectly on my computer.
    The issue is: When trying to use it from another computer with Office 2007 sometimes it crashes giving a runtime error 1004.
    all what I have to do to fix it is to open it from my computer and save it then it works on the other computer before it crashes after few times.
    Last edited by Kelshaer; 01-31-2012 at 09:13 AM.
    Regards,
    Khaled Elshaer
    www.BIMcentre.com

    Remember To Do the Following....
    1. Thank those who have helped you by clicking the Star below their post.
    2. Mark your post SOLVED if it has been answered satisfactorily:
    • Select Thread Tools (on top of your 1st post)
    • Select Mark this thread as Solved

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Macro crashes from time to time when running from another computer

    Does your macro involve too much of copy pasting? Anything that is clogging up the clipboard and also the memory which leads it to crash?
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  3. #3
    Valued Forum Contributor
    Join Date
    08-29-2011
    Location
    Mississauga, CANADA
    MS-Off Ver
    Excel 2010
    Posts
    503

    Re: Macro crashes from time to time when running from another computer

    No it Doesn't. Except for the below sentence which i think has nothing to do with the memory

    Please Login or Register  to view this content.
    Any help will be greatly appreciated

  4. #4
    Forum Expert OnErrorGoto0's Avatar
    Join Date
    12-30-2011
    Location
    I DO NOT POST HERE ANYMORE
    MS-Off Ver
    I DO NOT POST HERE ANYMORE
    Posts
    1,655

    Re: Macro crashes from time to time when running from another computer

    Have you narrowed down which line it crashes on?
    Good luck.

  5. #5
    Valued Forum Contributor
    Join Date
    08-29-2011
    Location
    Mississauga, CANADA
    MS-Off Ver
    Excel 2010
    Posts
    503

    Re: Macro crashes from time to time when running from another computer

    no. It runs good on my computer. The module is password protected and some times it gives that error when other employees are using it so it cant debug to point the exact line.

  6. #6
    Forum Expert OnErrorGoto0's Avatar
    Join Date
    12-30-2011
    Location
    I DO NOT POST HERE ANYMORE
    MS-Off Ver
    I DO NOT POST HERE ANYMORE
    Posts
    1,655

    Re: Macro crashes from time to time when running from another computer

    Did you write it? If so, you need to add error logging for situations like this! A generic error number caused occasionally by code we cannot see is hard to diagnose.

  7. #7
    Valued Forum Contributor
    Join Date
    08-29-2011
    Location
    Mississauga, CANADA
    MS-Off Ver
    Excel 2010
    Posts
    503

    Re: Macro crashes from time to time when running from another computer

    Thanks. I will investigate it and let you know

  8. #8
    Forum Expert OnErrorGoto0's Avatar
    Join Date
    12-30-2011
    Location
    I DO NOT POST HERE ANYMORE
    MS-Off Ver
    I DO NOT POST HERE ANYMORE
    Posts
    1,655

    Re: Macro crashes from time to time when running from another computer

    If you do not already use it, I would recommend getting hold of MZ Tools addin for VBA (it is free, but you can donate to the author if you find it useful) which will allow you to add line numbers to your code. You can then use a central error logging routine called from each routine, passing a module name and line number (using Erl).

  9. #9
    Valued Forum Contributor
    Join Date
    08-29-2011
    Location
    Mississauga, CANADA
    MS-Off Ver
    Excel 2010
    Posts
    503

    Re: Macro crashes from time to time when running from another computer

    never heared of it before.
    Thanks

  10. #10
    Forum Expert OnErrorGoto0's Avatar
    Join Date
    12-30-2011
    Location
    I DO NOT POST HERE ANYMORE
    MS-Off Ver
    I DO NOT POST HERE ANYMORE
    Posts
    1,655

    Re: Macro crashes from time to time when running from another computer

    You can get it here - it is truly invaluable.

  11. #11
    Valued Forum Contributor
    Join Date
    08-29-2011
    Location
    Mississauga, CANADA
    MS-Off Ver
    Excel 2010
    Posts
    503

    Re: Macro crashes from time to time when running from another computer

    Hi, well this is the line that crashes the program from time to time.

    Please Login or Register  to view this content.

  12. #12
    Forum Expert OnErrorGoto0's Avatar
    Join Date
    12-30-2011
    Location
    I DO NOT POST HERE ANYMORE
    MS-Off Ver
    I DO NOT POST HERE ANYMORE
    Posts
    1,655

    Re: Macro crashes from time to time when running from another computer

    Impossible for me to tell anything from that alone, since clearly there is nothing inherently wrong with saving a workbook. Could be network problems, permission issues, event code interfering and so on.

  13. #13
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: Macro crashes from time to time when running from another computer

    Hi, I have a suggestion.
    After ThisWorkbook.Save put a line of "DoEvents". This allows windows to do stuff and finish before coming back and trying to run the next line of your code. http://support.microsoft.com/kb/118468
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  14. #14
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Macro crashes from time to time when running from another computer

    Where will the workbook be saved ?
    Does the
    Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
    event contain any code ?
    Please Login or Register  to view this content.
    Last edited by snb; 01-26-2012 at 09:52 AM.



  15. #15
    Valued Forum Contributor
    Join Date
    08-29-2011
    Location
    Mississauga, CANADA
    MS-Off Ver
    Excel 2010
    Posts
    503

    Re: Macro crashes from time to time when running from another computer

    snb. I think it was solved. Thank you for the help.

+ 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