Project - VBA Project window - Excel 2003

J

Jarek Kujawa

Hi,

1. I open a file, write some code, then close the file

2. even though the file was closed it's code is still viewable in
Project - VBA Project window, as if the file was still open

the only way I know to have the file REALLY closed in Project - VBA
Project window is to Exit and re-start Excel

does anyone know a better way?

TIA
 
P

Patrick Molloy

the code modules are part of the workbook, so if you close the workbook, you
close the project. Have you written the code in the Personal.xls or somewhere
other that the workbook you thought?
 
S

Simon Lloyd

You can close the VBE Automatically like this:
Code:
--------------------
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Set MyVBe = ThisWorkbook.VBProject
If MyVBe.Mode = vbext_vm_Run Then
MyVBe.VBE.MainWindow.Visible = False
End If
End Sub
--------------------


Hi,

1. I open a file, write some code, then close the file

2. even though the file was closed it's code is still viewable in
Project - VBA Project window, as if the file was still open

the only way I know to have the file REALLY closed in Project - VBA
Project window is to Exit and re-start Excel

does anyone know a better way?

TIA


--
Simon Lloyd

Regards,
Simon Lloyd
'Microsoft Office Help' (http://www.thecodecage.com)
 
J

Jarek Kujawa

nope - I don't use personal.xls


ANY file behaves the way I described.

I close the file, it is closed BUT the project stays open.
I close all the files that were open and ALL of their VBA projects
remain open as if the files were still open

by double-clicking on the projects I can see all the code of any of
the files that were open
 
J

Jarek Kujawa

thks Simon

1. "Method 'VBProject' of object '_Workbook' failed" is what I'm
getting

2. am afraid this does not do what I am looking for - if I open/close
the same file several times I can see 'all' (the same) several
VBPRojects in VBE window
 
S

Simon Lloyd

You might have to add a reference to Microsoft Visual Basic For
Applications Extensions -x.x (where x.x is the version number)- from the
reference library found in the VBE>Tools>References
thks Simon

1. "Method 'VBProject' of object '_Workbook' failed" is what I'm
getting

2. am afraid this does not do what I am looking for - if I open/close
the same file several times I can see 'all' (the same) several
VBPRojects in VBE window



Lloyd' (http://www.thecodecage.com/forumz/member.php?userid=1)
Code Cage Forums'
(http://www.thecodecage.com/forumz/showthread.php?t=139660)


--
Simon Lloyd

Regards,
Simon Lloyd
'Microsoft Office Help' (http://www.thecodecage.com)
 
J

Jarek Kujawa

should I do that for any file?

cause I did that for several of them and to no avail

after restarting Excel and re-opening the files the library was not
added
 
C

Chip Pearson

I''ve seen that from time to time. I think it is a bug in the VBA
editor. Fortunately, it is harmless and you can safely ignore it.

Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)
 
J

Jarek Kujawa

thanks a lot Chip
I am an addicted reader of your site
;-)
I am trying ignore that bug but it is a bit annoying when trying to
test/introduce changes into the code
I just have too many same VBAProjects to choose from
;-)
I thought there is a way to get rid of it somehow
thanks for your feedback
 

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