Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Correct code to Exit Userform, with out Unloading data

I said nothing about that. But thanks for the additional insights.

--
Regards,
Tom Ogilvy


"Peter T" <peter_t@discussions wrote in message
...
when done extracting values, then the userform is unloaded.


AFAIK if the form is merely hidden the form as an object together with its
properties will stay in memory until explicitly unloaded even after the
procedure that show'd the modal form ends, at least in xl2000 and later
(in
xl97, if hidden, it unloads when the procedure that show'd the modal form
ends).

I may be on a similar time zone to Nick and it's late for me too,
apologies
if I've misinterpreted what you are saying.

Regards,
Peter T

"Tom Ogilvy" wrote in message
...
If controls are linked to cells, then values are updated when the cells
change - no relation to unload or hide

if you use code to write values to cells, then when the code runs the

cells
are updated. No relation to unload or hide

What Nick was say is that a lot of people hide the userform (modal) so
the
code that called then can continue to run. In that code, there is code
to
utililize the values in the controls of the userform such as

v = Userform1.Textbox1.Value

when done extracting values, then the userform is unloaded.

If you don't need to access any values from the calling code, then by all
means, unload the userform to close it rather than using the hide
command.

Understand what each method done, then utilize them appropriately to

achieve
the results you need.

--
regards,
Tom Ogilvy


"Corey" wrote in message
...
So if you .Hide THEN Unload, the values are not updated into a sheet?

But Unload without .Hide does ?
Corey....
"Nick Hodge" wrote in message
...
Corey

A normal procedure would be

'UserForm1 initialisation (Either design time or runtime)
UserForm1.Show (Shows and loads into memory, fires

UserForm_Initialize()
event)
'do what you want with the form
UserForm1.Hide
'Read all the controls and place or do with them what you will
Unload UserForm1
'This removes all the values and renders form unreadable (out of

memory)
'Start routine again

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
DTHIS
www.nickhodge.co.uk


"Corey" wrote in message
...
So to clear the data that was entered and to use the .hide,
The userform should be coded to clear all values upon Initializing
to
remove any values that were entered previously if the userform is
then
re-.shown?

Corey....
"Nick Hodge" wrote in

message
...
Corey

Hide is the only way to dismiss the form and persist the data,
Unload
removes it from memory and returns the controls to their design time
state and it cannot be read

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
DTHIS
www.nickhodge.co.uk


"Corey" wrote in message
...
What is the best way to close off a userform without unloading the
data.

Userform.hide simply hides the userform,
but is this good enough as a close?
As it still stores the data in the userform if something was placed
there.

Corey....













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
Userform to grab,correct and restore data jimapos[_2_] Excel Programming 1 September 27th 06 02:27 PM
Getting error unloading Userform?? Ed Excel Programming 3 July 1st 05 12:27 AM
Unloading UserForm not working Marston Excel Programming 2 August 17th 04 04:18 AM
Unloading userform in MSComm event Sunny[_4_] Excel Programming 0 June 10th 04 06:04 PM
Not Unloading a UserForm Mike[_49_] Excel Programming 1 January 29th 04 11:45 PM


All times are GMT +1. The time now is 06:35 AM.

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"