Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 169
Default Userform moves when hidden and shown again.

I have a segment of code in my application that hides the active form, opens
a new form, then one the new form is closed, shows the original form.
However, when the first form is shown, it has been repositioned. Any ideas
what is causing this and how to overcome it? frm1 is originally opened with
modal set to false.

frm1.Hide
frm2.Show
frm1.Show 0

Dale
--
Don''t forget to rate the post if it was helpful!

Email address is not valid.
Please reply to newsgroup only.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Userform moves when hidden and shown again.

If you don't find a solution you can always save the old position and then
restore the position


oldtop = userform1.top
oldleft = userform1.left
userform1.hide

'your code
userform1.top = oldtop
userform1.left = oldleft
userform1.show


"Dale Fye" wrote:

I have a segment of code in my application that hides the active form, opens
a new form, then one the new form is closed, shows the original form.
However, when the first form is shown, it has been repositioned. Any ideas
what is causing this and how to overcome it? frm1 is originally opened with
modal set to false.

frm1.Hide
frm2.Show
frm1.Show 0

Dale
--
Don''t forget to rate the post if it was helpful!

Email address is not valid.
Please reply to newsgroup only.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 169
Default Userform moves when hidden and shown again.

Joel,

What event would you put this in? I looked for an event that I thought
might fire when a form is moved, but didn't find one.

Dale

"Joel" wrote in message
...
If you don't find a solution you can always save the old position and then
restore the position


oldtop = userform1.top
oldleft = userform1.left
userform1.hide

'your code
userform1.top = oldtop
userform1.left = oldleft
userform1.show


"Dale Fye" wrote:

I have a segment of code in my application that hides the active form,
opens
a new form, then one the new form is closed, shows the original form.
However, when the first form is shown, it has been repositioned. Any
ideas
what is causing this and how to overcome it? frm1 is originally opened
with
modal set to false.

frm1.Hide
frm2.Show
frm1.Show 0

Dale
--
Don''t forget to rate the post if it was helpful!

Email address is not valid.
Please reply to newsgroup only.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Userform moves when hidden and shown again.

Do you need an event. Just put it in the code before the form is seen.

"Dale Fye" wrote:

Joel,

What event would you put this in? I looked for an event that I thought
might fire when a form is moved, but didn't find one.

Dale

"Joel" wrote in message
...
If you don't find a solution you can always save the old position and then
restore the position


oldtop = userform1.top
oldleft = userform1.left
userform1.hide

'your code
userform1.top = oldtop
userform1.left = oldleft
userform1.show


"Dale Fye" wrote:

I have a segment of code in my application that hides the active form,
opens
a new form, then one the new form is closed, shows the original form.
However, when the first form is shown, it has been repositioned. Any
ideas
what is causing this and how to overcome it? frm1 is originally opened
with
modal set to false.

frm1.Hide
frm2.Show
frm1.Show 0

Dale
--
Don''t forget to rate the post if it was helpful!

Email address is not valid.
Please reply to newsgroup only.




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 169
Default Userform moves when hidden and shown again.

If I'm going to put it in the same place the user left it, I need an event.

As it is, the form has a Left property of 50 (in design view). If I drag
the form to the left margin of the page and then test the Left property
before I hide the form, it returns a value of 0 +/- 1. Just before I execute
the .show method, when I check the Left property, it is still where it was
before I hid it *0 +/- 1). But immediately after the .show method, the form
pops back up with it's orginal position (left = 50).

Something about the show method is causing the form to reappear at it's
original position. I finally figured out that the form has a move method, so
before hiding it, I recorded the top and left properties, and after showing
it again, I used the move method to reposition it.

--
Don''t forget to rate the post if it was helpful!

Email address is not valid.
Please reply to newsgroup only.


"Joel" wrote:

Do you need an event. Just put it in the code before the form is seen.

"Dale Fye" wrote:

Joel,

What event would you put this in? I looked for an event that I thought
might fire when a form is moved, but didn't find one.

Dale

"Joel" wrote in message
...
If you don't find a solution you can always save the old position and then
restore the position


oldtop = userform1.top
oldleft = userform1.left
userform1.hide

'your code
userform1.top = oldtop
userform1.left = oldleft
userform1.show


"Dale Fye" wrote:

I have a segment of code in my application that hides the active form,
opens
a new form, then one the new form is closed, shows the original form.
However, when the first form is shown, it has been repositioned. Any
ideas
what is causing this and how to overcome it? frm1 is originally opened
with
modal set to false.

frm1.Hide
frm2.Show
frm1.Show 0

Dale
--
Don''t forget to rate the post if it was helpful!

Email address is not valid.
Please reply to newsgroup only.






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Userform moves when hidden and shown again.

Is there an initialize function in the userform? Maybe there is code in the
initialize function that is moving the form? Positioning the form can be
performed in the initialization function.

"Dale Fye" wrote:

If I'm going to put it in the same place the user left it, I need an event.

As it is, the form has a Left property of 50 (in design view). If I drag
the form to the left margin of the page and then test the Left property
before I hide the form, it returns a value of 0 +/- 1. Just before I execute
the .show method, when I check the Left property, it is still where it was
before I hid it *0 +/- 1). But immediately after the .show method, the form
pops back up with it's orginal position (left = 50).

Something about the show method is causing the form to reappear at it's
original position. I finally figured out that the form has a move method, so
before hiding it, I recorded the top and left properties, and after showing
it again, I used the move method to reposition it.

--
Don''t forget to rate the post if it was helpful!

Email address is not valid.
Please reply to newsgroup only.


"Joel" wrote:

Do you need an event. Just put it in the code before the form is seen.

"Dale Fye" wrote:

Joel,

What event would you put this in? I looked for an event that I thought
might fire when a form is moved, but didn't find one.

Dale

"Joel" wrote in message
...
If you don't find a solution you can always save the old position and then
restore the position


oldtop = userform1.top
oldleft = userform1.left
userform1.hide

'your code
userform1.top = oldtop
userform1.left = oldleft
userform1.show


"Dale Fye" wrote:

I have a segment of code in my application that hides the active form,
opens
a new form, then one the new form is closed, shows the original form.
However, when the first form is shown, it has been repositioned. Any
ideas
what is causing this and how to overcome it? frm1 is originally opened
with
modal set to false.

frm1.Hide
frm2.Show
frm1.Show 0

Dale
--
Don''t forget to rate the post if it was helpful!

Email address is not valid.
Please reply to newsgroup only.



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 169
Default Userform moves when hidden and shown again.

Joel,

There is code in the initialize event, but not to move the form. Plus, I
thought initialize only fired when the form was first loaded, not when it is
shown after already being loaded.

--
Don''t forget to rate the post if it was helpful!

Email address is not valid.
Please reply to newsgroup only.


"Joel" wrote:

Is there an initialize function in the userform? Maybe there is code in the
initialize function that is moving the form? Positioning the form can be
performed in the initialization function.

"Dale Fye" wrote:

If I'm going to put it in the same place the user left it, I need an event.

As it is, the form has a Left property of 50 (in design view). If I drag
the form to the left margin of the page and then test the Left property
before I hide the form, it returns a value of 0 +/- 1. Just before I execute
the .show method, when I check the Left property, it is still where it was
before I hid it *0 +/- 1). But immediately after the .show method, the form
pops back up with it's orginal position (left = 50).

Something about the show method is causing the form to reappear at it's
original position. I finally figured out that the form has a move method, so
before hiding it, I recorded the top and left properties, and after showing
it again, I used the move method to reposition it.

--
Don''t forget to rate the post if it was helpful!

Email address is not valid.
Please reply to newsgroup only.


"Joel" wrote:

Do you need an event. Just put it in the code before the form is seen.

"Dale Fye" wrote:

Joel,

What event would you put this in? I looked for an event that I thought
might fire when a form is moved, but didn't find one.

Dale

"Joel" wrote in message
...
If you don't find a solution you can always save the old position and then
restore the position


oldtop = userform1.top
oldleft = userform1.left
userform1.hide

'your code
userform1.top = oldtop
userform1.left = oldleft
userform1.show


"Dale Fye" wrote:

I have a segment of code in my application that hides the active form,
opens
a new form, then one the new form is closed, shows the original form.
However, when the first form is shown, it has been repositioned. Any
ideas
what is causing this and how to overcome it? frm1 is originally opened
with
modal set to false.

frm1.Hide
frm2.Show
frm1.Show 0

Dale
--
Don''t forget to rate the post if it was helpful!

Email address is not valid.
Please reply to newsgroup only.



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
Why the hidden column can't be shown on charts? ViestaWu Charts and Charting in Excel 1 June 26th 07 09:33 AM
UserForm initialize event run when UserForm is shown [email protected] Excel Programming 2 June 13th 07 02:49 AM
Excel hidden data shown in XML ??? user4574 Excel Programming 0 September 27th 06 04:55 AM
Excel: copy and paste only shown not hidden cells into new sheet MU Excel Discussion (Misc queries) 1 February 6th 06 10:31 PM
Userform to enter values and shown in same userform in list helmekki[_104_] Excel Programming 0 November 19th 05 03:23 PM


All times are GMT +1. The time now is 05:18 AM.

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"