Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default Unloading userforms

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 812
Default Unloading userforms

Each procedure goes with which UserForm?

Run "a" doesn't work for me. 'Call a' or 'a' (w/o the quotes) does.

You don't have to Unload a Userform. You can use Hide if you may want
to show it again.

It might help to say what you want to do.

Merjet


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default Unloading userforms

On 12 May, 13:26, merjet wrote:
Each procedure goes with which UserForm?

Run "a" doesn't work for me. 'Call a' or 'a' (w/o the quotes) does.

You don't have to Unload a Userform. You can use Hide if you may want
to show it again.

It might help to say what you want to do.

Merjet


Thanks

I have written an estimating system where the user puts the infomation
into a spreadsheet via a userform. To make it easier for the user i
have 1 userform to enter the parts details, i userform to enter the
materials details and finally 1 userform for the labour details, this
then returns to a menu which is also a userform. My problem is that i
can only enter about 30 parts etc... then it will error 28 memory
stack is full. i have found the problem is the loading/unloding
userforms.

Addy

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Unloading userforms

If you examine the call stack (go into debug mode then use Ctrl-L) you
will see that the problem is not with loading and unloading the forms,
but because your "a" and "b" procedures get called recursively and
never terminate.

Peter Grebenik



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default Unloading userforms

On 12 May, 14:01, Peter Grebenik wrote:
If you examine the call stack (go into debug mode then use Ctrl-L) you
will see that the problem is not with loading and unloading the forms,
but because your "a" and "b" procedures get called recursively and
never terminate.

Peter Grebenik


Hi

I have taken your advise and have now not used the a & b procedures
and now switch from one userform to another and i have found that when
i switch they do not unload from the memory stack and after a while i
still get the error 28.

Is there a way of stopping the buildup in the memory or am i asking to
much?

thanks

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Unloading userforms

Without seeing the code, I don't know.

Have you thought of using a multipage control on your userform to get
around the problem of constantly loading and unloading forms?

Peter Grebenik

Reply
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
Unloading DLL's Bosco Excel Programming 1 September 29th 06 03:12 PM
Unloading a Form VBA Fun Excel Programming 2 March 7th 06 01:45 AM
Unloading a form using the ESC key johncassell[_24_] Excel Programming 2 August 16th 05 06:19 PM
Unloading A Form Chrissy[_4_] Excel Programming 1 October 15th 03 02:17 PM
Unloading an Add-In Jack Excel Programming 1 October 1st 03 09:39 AM


All times are GMT +1. The time now is 07:51 PM.

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

About Us

"It's about Microsoft Excel"