Solved

Excel 2010 VBA form position

Posted on 2012-04-13
1
626 Views
Last Modified: 2012-04-17
Hi Experts

I have an excel spreadsheet with a user form, I cant position the form where I would prefer as I have a dual monitor and the application.left and application.top are positions based upon the 1st monitor posistion.

Ideally I want the form positioned on top of where the spreadhsheet is positioned.

Many thanks
0
Comment
Question by:MrDavidThorn
1 Comment
 
LVL 16

Accepted Solution

by:
theo kouwenhoven earned 500 total points
ID: 37842166
In the form properties, you can choose:

StartUpPosition = x

Where x can be 0 to 3

0 = Manual (you define where is should start with the Form.top and Form.Left function)
1 = Center owner (Center owner is the middle of your excelsheet)
2 = Center Screen (Center of the screen where the Excel sheet is opened)
3 = Window default (Coordinates 0,0)

If you like to open it relative to the excelsheet, use the following code:

UserForm1.StartUpPosition = 0
UserForm1.Left = Application.Left + 80
UserForm1.Top = Application.Top + 50
UserForm1.Show
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

919 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now