View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
RB Smissaert RB Smissaert is offline
external usenet poster
 
Posts: 2,452
Default Unloading userforms

It looks you have to keep better track of which forms are loaded or not or
avoid the error by doing On Error Resume Next.

RBS

"Oggy" wrote in message
oups.com...
Hi

I have wrote a few macros to open up a userform and when finished,
with a comand boutton open a different userform. I keep getting an
error 28 after running them for a little while. I have recreated the
problem by writing the following code to establish the loading of
userforms is the problem. has anyone got any suggestions on how i can
resolve the problem.

Thanks in advance

Addy




Private Sub CommandButton1_Click()
Unload userform2
Set userform2 = Nothing
Run "a"
End Sub



Sub a()
userform1.Show
Unload userform1
Set userform1 = Nothing
End Sub


Private Sub CommandButton1_Click()
Unload userform1
Set userform1 = Nothing
Run "b"
End Sub

Sub b()
userform2.Show
Unload userform2
Set userform2 = Nothing
End Sub