Thread: VBA References
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Rob van Gelder[_4_] Rob van Gelder[_4_] is offline
external usenet poster
 
Posts: 1,236
Default VBA References

TT,

You could do something like:

With ThisWorkbook.VBProject
.References.Remove .References("MyVBAProject")
End With
MyVBAProject.ThisWorkbook.Close

Be sure not to save changes to your own workbook, else the reference is gone
for good!

Rob


"Tommy T" wrote in message
...
I have a workbook that references an add-in. I am trying
to close the add-in when I close the workbook, but I
can't get it to work. I just get the message that "This
workbook is currently referenced by another workbook and
cannot be closed." I've tried putting the code in the
BeforeClose event, but since the workbook is technically
not closed yet, it still doesn't work.

Any Suggestions?
TT