Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Ghost code from User-defined Add-Ins
Hi all,
Something very weird is happening with my user-defined Add-In Excel VBA modules. I have a set of "common" routines (like CheckFileonDisk(), getSortedRow() etc) that I put into a CommonMacros.xla file, and am referencing them thru Tools-AddIns and Tools-References. It used to be working fine, but past couple of days I am observing a strange problem - and am experiencing what I call "ghost" code. In the course of development (of my other main modules), I found some bugs in one of the CommonMacros procedures, fixed them and also added a new function procedure. Everything seems to be fine except that it insists on executing some code that I have commented out!!!!! (during bugfixing) There are a few MsgBox statements that I put in the Add-In procedure during the course of debugging, and commented them out later. However many times I de-link and re-link the AddIn reference, it always executes these (currently commented out) MsgBox statements. I even tried adding some new statements at the beginning of the buggy add-in procedure and put a breakpoint there. During execution, it comes to the breakpoint, but skips the newly added statements entirely and keeps displaying the (visibly commented out) MsgBox statements!!! If I de-link the reference, re-link it again, save the changes and execute my macro *without exiting Excel*, it is working fine (the ghost code is not executed). But if I restart Excel and my application, it appears again!!! My surmise (could be wrong) is that my previous save of the newly created Reference was silently ignored? Overall, I would say that the problem seems to be that I cannot seem to get a recompile done on my Add-In module and Excel somehow "remembers" only the older version... I have tried quick-and-dirty things like renaming files, copying them, etc and nothing seems to work. The xla file is not saved in any default directory (i didnt know what was default at saving time). Please help with any inputs.... My advance thanks for any & all help... Thanks & Regards, -feltra PS: This is how I unlinked and re-linked the AddIn module. a) remove the reference to the Add-in in the Tools-AddIns (from both Excel and VBA Editor windows) b) Save the changes c) Exit Excel d) Restart Excel e) Tie in the addin code in Excel thru Tools-<AddIns f) Tie in the addin code in VBA Editor thru Tools-References |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Ghost code from User-defined Add-Ins
I've never seen anything like this.
But is there a chance that an earlier version of the addin gets loaded instead (or along with)? Next time it happens, stop the code. Inside the VBE hit ctrl-r to see the project explorer Look to see what files/projects are open. If you only see your data workbook and the addin hit ctrl-g to see the immediate window type this and hit enter: ?workbooks("youraddinname.xla").fullname Is that returned name what you expected? ====== And if everything looks fine, maybe running Rob Bovey's code cleaner would help: You can find it he http://www.appspro.com/ or directly http://www.appspro.com/Utilities/CodeCleaner.htm feltra wrote: Hi all, Something very weird is happening with my user-defined Add-In Excel VBA modules. I have a set of "common" routines (like CheckFileonDisk(), getSortedRow() etc) that I put into a CommonMacros.xla file, and am referencing them thru Tools-AddIns and Tools-References. It used to be working fine, but past couple of days I am observing a strange problem - and am experiencing what I call "ghost" code. In the course of development (of my other main modules), I found some bugs in one of the CommonMacros procedures, fixed them and also added a new function procedure. Everything seems to be fine except that it insists on executing some code that I have commented out!!!!! (during bugfixing) There are a few MsgBox statements that I put in the Add-In procedure during the course of debugging, and commented them out later. However many times I de-link and re-link the AddIn reference, it always executes these (currently commented out) MsgBox statements. I even tried adding some new statements at the beginning of the buggy add-in procedure and put a breakpoint there. During execution, it comes to the breakpoint, but skips the newly added statements entirely and keeps displaying the (visibly commented out) MsgBox statements!!! If I de-link the reference, re-link it again, save the changes and execute my macro *without exiting Excel*, it is working fine (the ghost code is not executed). But if I restart Excel and my application, it appears again!!! My surmise (could be wrong) is that my previous save of the newly created Reference was silently ignored? Overall, I would say that the problem seems to be that I cannot seem to get a recompile done on my Add-In module and Excel somehow "remembers" only the older version... I have tried quick-and-dirty things like renaming files, copying them, etc and nothing seems to work. The xla file is not saved in any default directory (i didnt know what was default at saving time). Please help with any inputs.... My advance thanks for any & all help... Thanks & Regards, -feltra PS: This is how I unlinked and re-linked the AddIn module. a) remove the reference to the Add-in in the Tools-AddIns (from both Excel and VBA Editor windows) b) Save the changes c) Exit Excel d) Restart Excel e) Tie in the addin code in Excel thru Tools-<AddIns f) Tie in the addin code in VBA Editor thru Tools-References -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
user defined function | Excel Worksheet Functions | |||
user defined function | Excel Worksheet Functions | |||
"User-defined type not defined" message in Excel | Excel Discussion (Misc queries) | |||
User Defined Functions | Excel Worksheet Functions | |||
User-defined function | Excel Worksheet Functions |