Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Why the hidden column can't be shown on charts? | Charts and Charting in Excel | |||
UserForm initialize event run when UserForm is shown | Excel Programming | |||
Excel hidden data shown in XML ??? | Excel Programming | |||
Excel: copy and paste only shown not hidden cells into new sheet | Excel Discussion (Misc queries) | |||
Userform to enter values and shown in same userform in list | Excel Programming |