Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VBA project explorer still showing the excel workbooks which are closed by the macro

Tags:

excel

vba

I have created a macro that opens a excel workbook and performs some operations and then at the end it closes the file.The macro is running fine.

Now, when I open my VBA Project explorer in the vba editor. It shows the list of files that have been opened by the macro even though they are closed. How do i remove them from the project explorer window ? why its still showing the excel workbooks, which are already closed ? is there anyway to fix it or its a limitation?

like image 893
niko Avatar asked Oct 11 '11 06:10

niko


People also ask

How do you fix this workbook has lost its VBA project ActiveX controls and any other programmability related features?

This workbook has lost its VBA project, ActiveX controls and any other programmability-related features. During the installation of Microsoft Office 2007, "Visual Basic for Applications" was not installed. To solve this you need to change your installation of Microsoft Office. Close all Microsoft Applications.


1 Answers

I found the answer myself.

Dim Excel_workbook As Excel.Workbook
Set Excel_workbook = Workbooks.Open("somefile name");
' some code goes here 
' at the end write the below statement
Set Excel_workbook = Nothing 'worked, I found at the 12 page of google search

This is the link that helped me http://www.mrexcel.com/forum/showthread.php?t=50086

like image 80
niko Avatar answered Sep 28 '22 05:09

niko