Code was working all the time, now sometimes it does and sometimes...
I have this little bit of code at the end of a sub to save the name of an
open Excel workbook: oxlWks.Application.DisplayAlerts = False oxlWks.Application.ActiveWorkbook.SaveAs filename:=fname, FileFormat:=xlNormal oxlWks.Application.DisplayAlerts = True I have run this hundreds of times before without a problem, yet today it was bombing out on me. I had made a small change to the sub, so I opened a prior version without the change and still had the problem. I get a message saying "The server threw an exception". This is happening more times than not, but not always. The sub creates a workbook of the same name earlier in the code, so when it works vs. when it does not work always involves saving over an existing workbook of the same name. I do seem to be having memory leaks, Excel will not shut down properly. That may be related to the problem after it occurs, but it may be unrelated to the cause, I really do not know. I went to the directory where all of these workbooks were being saved, deleted them and then the system ran fine again with no problems at all - I ran the same customer over and over so it would be sure to overwrite the file and it did so easily. While this now seems to work, I am concerned about a recurrence of this. Any ideas about what could be causing this? Is it time to get incense and sacrifice a chicken? |
All times are GMT +1. The time now is 03:27 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com