Jean-Guy Marcil said:
For something like this you need to first find out what the user's screen
resolution is, otherwise you might position the userform totally off the
screen!
Once you know that, you can calculate where to position the ".Top" and
".Left" proprerties of the userform in its Initialize event.
To get the Screen Resolution:
Dim lngHor As Long
Dim lngVert As Long
With System
lngHor = .HorizontalResolution
lngVert = .VerticalResolution
End With
MsgBox lngHor
MsgBox lngVert
Then you need to apply some percent type of calculation to position the
userform as you wish. Of course, thorough testing is recommended. Change your
screen resolution and then run your code to see the results.
Hello,
EllenM and I are working on this project together and perhaps I should
provide some clarification.
First, thanks for the quick reply.
We probably didn't communicate that clearly how the 2 forms interact with
one another. The solution you posted works fine if the small form is embedded
within the larger form. However, we did not design our project that way. We
created 2 separate userforms independent of one another such that, during
runtime, the large form appears onscreen containing a button which, when
pressed, launches a smaller separate window which happens to be another
userform. As you know, all windows be it forms or dialog boxes appear dead
center when they first appear onscreen.
The reason we mentioned the "StartUpPosition" Property is because I was
wondering if you could somehow programmatically bypass what seems to be the
only 4 options for positioning dialog boxes on the screeen. To reiterate, I
want the smaller window to appear off-center to the larger window. See below.
When EllenM and I search VBA help for Word using "StartUpPosition" as the
search term, we retrieved the following. Only 4 options appear. Any help
appreciated. Thanks again.
Manual 0 No initial setting specified.
CenterOwner 1 Center on the item to which the UserForm belongs.
CenterScreen 2 Center on the whole screen.
WindowsDefault 3 Position in upper-left corner of screen.