duplicate vb projects occur when reopening a sheet

A

Allan

Strange, I have written vb code which updates data when the file is opened.
But when I close the workbook the vb project is still showing in the vb
window.
So when I reopen up the workbook I now have two instances of the vb project
and none of the code executes. However when I close excel 2003 and open the
workbook then everything runs fine.

Any ideas,

Allan
 
J

Joel

Did you copy any worksheets in your code? Make sure when you copy a
worksheet you include either before of after otherwise a new workbook is
created.

sheets("sheet1").copy after:=sheets(sheets.count)
 
B

Bob Phillips

He is talking about duplicate entries for the project within the project
explorer.

--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)
 
J

Joel

bob: if Allan alunch a 2nd excel application from his macro is could be
invisible and would not terminate when the workbook is closed. I thinnk we
need to see Allan's code or a better description of what he is doing to give
him the proper answer.
 
A

Allan

Thanks guys, but im not laucnhing a 2nd excel app.

But what I've done is eliminate a copy of a sheet to a backup sheet.
then I added
Private Sub Workbook_BeforeClose(Cancel As Boolean)
ActiveWorkbook.Save
End Sub

This seemed to solve the problem.

But after an hour or so of testing all of a sudden when I close the
workbook a msg box appears asking me if i want to save the changes. i would
have thought the ActiveWorkbook.Save would take care of this.

I'm Stumped
 
J

Joel

If you are closing from a macro then you need to add savechanges to eliminate
the prompt.

Workbooks("BOOK1.XLS").Close SaveChanges:=true
 
P

Peter T

Try searching this group for "Phantom Projects". Not so much in the hope of
finding a solution but to give some comfort it doesn't only affect you!

Having said that, I think Jon Peltier had a theory that third party VSTO
type addns were implicated. That wasn't applicable to me and I posted some
code that sorted out mine, though I don't recall anyone reported it of being
any use to them.

Regards,
Peter T
 
A

Allan

It seems that i forgot to add the statement .
Application.EnableEvents = True after I set it to false.

I have two combo box's that read from a sheet but the first box sets the
second box and the second box can set the first box
I orginally set Application.EnableEvents = false so they wouldn' t undo
what the other did.

Whether this had anything to do with having the vb project name remain
after the workbook was closed and duplicated when the workbook was reopened
I don't know but so far it has has resolved this issue

Thanks all for the suggestions
 
B

Bob Phillips

I had problems with MicroCharts COM addin generating phantom in my system.
Removing the addin cleared the problem.

--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)
 
B

Bob Phillips

Joel,

He is talking about spurious duplicates. I know, I have had them, caused by
3rd party addins.

--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top