Results 1 to 3 of 3
  1. #1
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Dual monitors (WordXP)

    I'm writing Word/VBA gui forms for a client. The client has a computer with two monitors (I find it quite annoying because the client's brain knows where the next bit of data will flash, but I'm always two seconds behind ....).

    I'm supposed to throw my GUI form up onto one of the two monitors, I gather "the monitor where this GUI form was most recently placed.

    As usual, I haven't a clue, and throw my ignorance in the street for all to see. And beg for help.

    The VBA Help offers me this:
    StartUpPosition Property
    Returns or sets a value specifying the position of a UserForm when it first appears.
    You can use one of four settings for StartUpPosition:
    Setting Value Description
    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.
    Remarks
    You can set the StartUpPosition property programmatically or from the Properties window.


    Of these, "0" makes no sense, 2 and 3 don't appear to make sense.

    In my UserForm I can see something like this <pre>Private Sub UserForm_Layout()

    End Sub</pre>

    that offers faint hope, but am not sure .....


    I figure that if I knew where I was when the user chose OK/Cancel, and remembered that in an INI file, I could use it during the next initialisation event. That would be .Top and .Left for the form.

    Is this all there is to life?

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Dual monitors (WordXP)

    I think you should forget about everything above this part:

    > I figure that if I knew where I was when the user chose OK/Cancel, and remembered that in an INI file,
    > I could use it during the next initialisation event. That would be .Top and .Left for the form.

    Implementing that should be all you need, no?

  3. #3
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Dual monitors (WordXP)

    > Implementing that should be all you need, no?
    Yup. Why is that posting a question when I'm stumped seems to un-log-jam my brain?

    1) In the GUI form (properties) set StartupPosition= 0 manual.
    2) In the userform Initialise code set<pre> Me.Top = strProfileIn(strEnvironmentPath & "" & strcApplication, strcApplication, "Top", 0)
    Me.Left = strProfileIn(strEnvironmentPath & "" & strcApplication, strcApplication, "Left", 0)</pre>

    3) On the command OK and Cancel click events set<pre> Call strProfileOut(strEnvironmentPath & strcApplication & ".ini", strcApplication, "TOP", Me.Top)
    Call strProfileOut(strEnvironmentPath & strcApplication & ".ini", strcApplication, "LEFT", Me.Left)</pre>

    A doddle, really.


    Oh yeah. Now I have to test it on the client's system, .......

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •