![]() |
Code compiles but Excel ERROR
Hi,
I have basically finished coding a workbook for my work to create Testnumbers for inter-office faxing authentication. Everything works fine, all the code compiles and all the buttons and userforms display and show/do as expected. I can also save the book, BUT about 2 days ago , when I CLOSE/Exit the wb Windows gives the Dreaded "This program have performed an Illegal operation" moan message & closes and locks Excel! Is my code badly written? to many loops? I tried to do things differently, here and there, but to no avail. Is there any basic things to checkup on, for this error. Isn't Excel suppose to pickup any errors in your code, and avoid this? Any help will be GREATLY appreciated... |
Code compiles but Excel ERROR
Hi,
I don't know if this applies to you, but one time I had Excel lock up on me because I had two subroutines with exactly the same name. Excel did not like that at all! I think it just shut down...or I had a dreaded message you got, and then it shut down automatically. The only way I could get in the Excel Workbook, was to push the disable- macro button, and then find the duplication. I don't know if you would have to disable the macros too. It doesn't sound necessary, but I thought I would mention it anyway. It was so obvious, but it took me sometime to break old habits of always hitting the enable-macro button, before I realized an easy way of getting in, when there was a VBA programming conflict such as that. Maybe to find your coding problem, you could comment out sections of code, line by line...possibly at first eliminating some of the modules. Keep doing it, until it goes away. I know that might be boring and laborious, but I think you'll at least isolate the section that is giving you the problems. I'm not sure if this would work in your case, but here's some code to identify errors. This is some sample language to add to each of your subroutines. Sub YourSubroutines() ~~~Dim Variables Here~~~ On Error GoTo Line1: ~~~Code Here ~~~ Exit sub Line1: MsgBox Err.Number & " " & Err.Description End Sub I hope that helps some. Rick -----Original Message----- Hi, I have basically finished coding a workbook for my work to create Testnumbers for inter-office faxing authentication. Everything works fine, all the code compiles and all the buttons and userforms display and show/do as expected. I can also save the book, BUT about 2 days ago , when I CLOSE/Exit the wb Windows gives the Dreaded "This program have performed an Illegal operation" moan message & closes and locks Excel! Is my code badly written? to many loops? I tried to do things differently, here and there, but to no avail. Is there any basic things to checkup on, for this error. Isn't Excel suppose to pickup any errors in your code, and avoid this? Any help will be GREATLY appreciated... . |
Code compiles but Excel ERROR
Hi,
Thanks for the reply Nick. Just to let you now, I found the problem and it was quit interesting. ======== As I played around with the wb design and stuff, copying, deleting, renaming and moving sheets I somehow messed up their naming order as by its property name (not the TAB name). I noticed this as I was copying the sheets , code and modules to a blank wb (Someone on another site told me to do this) Sheet1 was sheet nr 2 in the wb (TAB named the same) then there was Sheet4 wich was sheet nr 1 in the wb (TAB named the same) then Sheet2 wich was sheet nr 3. (TAB also correct) It was wrong and/or defragmented. I renamed the sheets names to the same name as their TAB's and moved them in the same order on the Project browser as displayed in the wb view. I saved and closed and believe it or not NO error! Was it the renaming OR the Copying of the code, sheets and modules to a blank wb? that did the trick, I HAD to know I tried the same porcedure from a saved error-copy of my project. Made sure first it was still busted before I started. I copied , but did not rename, then saved and closed. Sure enough, my favoured popup blasted onto the screen. I reoped the same wb , renamed & sorted the sheets ,saved and closed. 100% OK! This was a first for me, quess that is how you learn. Thanks again, roba |
All times are GMT +1. The time now is 12:12 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com