LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Phantom VBA Projects (again)

Personally I could never attribute the problem to some other addin, though
in discussion you referred to Jon Peltier seemed to suspect otherwise.

The ClosePhantoms routine was designed only to close a phantom "xls" that
had a path (ie previously saved) and assuming its fullname could be obtained
and a reference set to it as a workbook.

If your phantoms are not as described above, ie previously saved addins, try
the following and see if you can at least obtain a handle to your
phantom(s).

Sub Test()
Dim s$
Dim idx As Long, i As Long
Dim wb As Workbook
Dim vbp As Object

'' try both types of Loop, ie 'For Each' & 'For i = 1'
'' (comment 'Set vbp =' if looping 'For Each' )

'For Each vbp In Application.VBE.vbprojects
For i = 1 To Application.VBE.vbprojects.Count

idx = idx + 1
s = " - ": Set wb = Nothing: Err.Clear

On Error GoTo errH
Set vbp = Application.VBE.vbprojects(i) 'comment if For Each

On Error Resume Next

s = vbp.Filename
If s = " - " Then
' could be a non-phantom unsaved wb, eg "Book1"
' but not possible get the wb.name from vbp
' to set a wb reference
Err.Clear
s = s & vbp.Name

Else

s = Mid$(s, InStrRev(s, "\") + 1, 200)

Set wb = Workbooks(s)

End If
resNext:
Debug.Print idx, Err.Number, Not wb Is Nothing, s

Next

Exit Sub
errH:
Resume resNext

End Sub


If in this test you can set a reference to your phantom, put a break on the
debug line and when you get to your phantom try -
wb.Close

If (?) that works it should be possible to adapt to distinguish normally
loaded files and attempt to delete only the phantom(s).

Regards,
Peter T


"Gizmo63" wrote in message
...
Hi all,

These well discussed phantom projects that remain even when the workbooks
are closed are a real pain.
Concensus seems to point to add-ins or VSTO items but here's the rub:
Corporately we all have the same build but no others have the same problem
so that's VSTO out of my equation.

Of the other folk with this problem are any of you using Microstrategy
Office, Microstrategy Desktop or FastExcel. Office wise the only thing I

have
that no one else does is MSAccess.

These are the unique aspects to my pc.

FastExcel has been removed and the pc rebooted with no effect - could
something be left lurking?
Microstrategy is a pain to remove and reinstall so I'd like to leave this

as
a last option.

Peter T's subroutine to kill of the phantoms has no effect either.

Need some help - these ghosts are getting to me!



 
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
Phantom Links Engineering Accountant Excel Discussion (Misc queries) 2 October 13th 08 06:22 PM
Application.Run and VBE "phantom" projects Keith Johnson[_2_] Excel Programming 0 March 3rd 06 07:15 PM
phantom headers dave Excel Discussion (Misc queries) 5 February 25th 05 06:03 PM
phantom headers dave Excel Worksheet Functions 1 February 24th 05 11:33 PM
How to become a better programmer, post college. More projects or less projects. Matt Somers Excel Programming 1 February 12th 04 01:54 PM


All times are GMT +1. The time now is 06:03 PM.

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

About Us

"It's about Microsoft Excel"