Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 24
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
user defined function ub Excel Worksheet Functions 6 April 4th 07 09:42 PM
user defined function delmac Excel Worksheet Functions 1 August 11th 06 04:31 PM
"User-defined type not defined" message in Excel RW1946 Excel Discussion (Misc queries) 0 August 31st 05 12:14 PM
User Defined Functions Frank@shell Excel Worksheet Functions 3 April 20th 05 02:41 PM
User-defined function PierreL Excel Worksheet Functions 4 December 23rd 04 09:16 AM


All times are GMT +1. The time now is 02:30 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"