Thread: Mystery objects
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
SimonN[_2_] SimonN[_2_] is offline
external usenet poster
 
Posts: 1
Default Mystery objects

Hi all,

I have recently spent a lot of time developing an Excel-based project
but am stuck on one problem that I just can't find an answer to.

My project is password protected. If I open it, cause a form to be
displayed (any form) and then close or quit Excel, the project
password prompt appears.

I know this symptom is commonly due to objects not being released. I
have therefore put together a very simple test workbook comprising one
sheet and one form. The sheet has a button to display the form. The
form has a single button which performs an Unload Me.

The worksheet code is simply:

Private Sub showform_Click()

Dim fm As New UserForm1

fm.Show
' (form then unloads itself)
Set fm = Nothing

End Sub

UserForms.Count is zero after I run this. There is nothing else in
the workbook. The problem doesn't occur if I open and then quit
without showing the form.

I have also tried similar code without declaring a new object (i.e.
UserForm1.Show etc) but with the same result.

I am using VB 6.3 in Excel 2002.

Any advice would be very greatly appreciated.

Thanks
Simon (London).