View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
StephanieH StephanieH is offline
external usenet poster
 
Posts: 95
Default Show/Unload Userform

I use
Sub NetWEFPlotting()
frmWEFNetPlotting.Show
End Sub

to bring up the form. Then within my form:

Private Sub Cancel_Click()
Unload frmWEFNetPlotting
End Sub
Private Sub OK_Click()
For i = 0 To ListBox1.ListCount - 1
If ListBox1.Selected(i) Then
Workbooks.Open
Filename:="\\Fl-msjf-fs1\Data\Data\RECOVERY\EXLDATA\Loan Recovery MIS\Net
Placement Plotting\WEF\WEF " & ListBox1.List(i) & " Net Plotting by
Placement.xls"
End If
Next i
Unload frmWEFNetPlotting
End Sub
Private Sub Userform_Initialize()
With ListBox1
.AddItem "Primary", 0
.AddItem "Secondary", 1
.AddItem "Tertiary", 2
.AddItem "Deceased", 3
.AddItem "Internal", 4
.AddItem "IGATLB", 5
End With
End Sub



I just switched it to "Unload Me" and that works fine. I'll leave it that
way, but that was really strange.

"Ron de Bruin" wrote:

Strange

If you use "Unload Me" in the code in the userform module do you have the same problem then

Where do you use the code line
Unload frmWEFNetPlotting

--
Regards Ron de Bruin
http://www.rondebruin.nl



"StephanieH" wrote in message ...
For some reason, I keep getting a message "Runtime error 361. Can't unload
this object."

The part that has me stumped is that
"frmWEFNetPlotting.Show" works fine.

"Unload frmWEFNetPlotting" debugs with that message.

Any suggestions? Obviously they're referencing the same object, but I don't
see why it will show the object, but then not unload it.