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 08:13 AM.
Regards,
Khaled Elshaer
www.BIMcentre.com
Remember To Do the Following....
- Thank those who have helped you by clicking the Star below their post.
- 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
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?
Cheers,
Arlette
If I 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]
No it Doesn't. Except for the below sentence which i think has nothing to do with the memory
Any help will be greatly appreciatedshtJOBs.Copy After:=ThisWorkbook.Sheets(ThisWorkbook.Sheets.Count)
Regards,
Khaled Elshaer
www.BIMcentre.com
Remember To Do the Following....
- Thank those who have helped you by clicking the Star below their post.
- 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
Have you narrowed down which line it crashes on?
Good luck.
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.
Regards,
Khaled Elshaer
www.BIMcentre.com
Remember To Do the Following....
- Thank those who have helped you by clicking the Star below their post.
- 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
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.
Good luck.
Thanks. I will investigate it and let you know
Regards,
Khaled Elshaer
www.BIMcentre.com
Remember To Do the Following....
- Thank those who have helped you by clicking the Star below their post.
- 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
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).
Good luck.
never heared of it before.
Thanks
Regards,
Khaled Elshaer
www.BIMcentre.com
Remember To Do the Following....
- Thank those who have helped you by clicking the Star below their post.
- 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
You can get it here - it is truly invaluable.
Good luck.
Hi, well this is the line that crashes the program from time to time.
ThisWorkbook.Save
Regards,
Khaled Elshaer
www.BIMcentre.com
Remember To Do the Following....
- Thank those who have helped you by clicking the Star below their post.
- 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
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.
Good luck.
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 * below to say thanks.
Where will the workbook be saved ?
Does the
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
event contain any code ?
sub snb() ThisWorkbook.Saved = False Thisworkbook.save Do Until ThisWorkbook.Saved doevents Loop end sub
Last edited by snb; 01-26-2012 at 08:52 AM.
snb. I think it was solved. Thank you for the help.
Regards,
Khaled Elshaer
www.BIMcentre.com
Remember To Do the Following....
- Thank those who have helped you by clicking the Star below their post.
- 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
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks