A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » Charts and Charting
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Open userform on MouseMove at a prticular point



 
 
Thread Tools Display Modes
  #1  
Old November 3rd, 2004, 08:56 AM
mangesh_yadav
external usenet poster
 
Posts: n/a
Default Open userform on MouseMove at a prticular point


I am showing some data in a UserForm on a chart using the MouseMove
event. When I move the mouse over a series, the form opens up showing
some data.

I want to open the form exactly at the point where the mouse is, for
which I use the following code:


Private Sub Chart_MouseMove(ByVal Button As Long, ByVal Shift As Long,
ByVal x As Long, ByVal y As Long)

ActiveChart.GetChartElement x, y, IDNum, a, b
' here x, y are the positions of the chart

UserForm.StartUpPosition = 0
UserForm.left = x
UserForm.top = y

UserForm.Show

--------------

But the problem is that the form does not open near the mouse cursor.
Any ideas...

- Mangesh


--
mangesh_yadav
------------------------------------------------------------------------
mangesh_yadav's Profile: http://www.excelforum.com/member.php...o&userid=10470
View this thread: http://www.excelforum.com/showthread...hreadid=274803

  #2  
Old November 5th, 2004, 03:17 AM
Jon Peltier
external usenet poster
 
Posts: n/a
Default

Hi Mangesh -

Welcome to the world of relative coordinate systems. X and Y in the chart event are
in chart object client coordinates, which are in pixels from the top left of the
chartobject object. On my system, a point is 0.75 pixels; this depends on the
Windows font size setting (large fonts/small fonts). The chartobject's position from
the top left of cell A1 is given by the .Top and .Left properties of the
ChartObject. A UserForm is positioned relative to the top left of the screen (the
main screen if you're using multiple monitors), in points.

Chip Pearson has a neat utility on his web site that helps you locate forms relative
to cells in the Excel window. It accounts for scrolled windows, toolbars, etc.
You'll have to work with it a little to account for the position of the click within
the chart.

http://cpearson.com/excel/FormPosition.htm

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
Tutorials and Custom Solutions
http://PeltierTech.com/
_______

mangesh_yadav wrote:

I am showing some data in a UserForm on a chart using the MouseMove
event. When I move the mouse over a series, the form opens up showing
some data.

I want to open the form exactly at the point where the mouse is, for
which I use the following code:


Private Sub Chart_MouseMove(ByVal Button As Long, ByVal Shift As Long,
ByVal x As Long, ByVal y As Long)

ActiveChart.GetChartElement x, y, IDNum, a, b
' here x, y are the positions of the chart

UserForm.StartUpPosition = 0
UserForm.left = x
UserForm.top = y

UserForm.Show

--------------

But the problem is that the form does not open near the mouse cursor.
Any ideas...

- Mangesh



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Error Message when I try to open Excel files TerriM128 General Discussion 4 June 17th, 2004 07:10 AM
Can't open data if someone has the database open? MJV New Users 2 May 29th, 2004 12:50 PM
Excel 2000 will not open a file. Jim Stephens Setting up and Configuration 2 May 19th, 2004 01:15 PM
Open Files in a new workbook TIM HAGEDORN Setting up and Configuration 5 May 5th, 2004 06:42 PM
excel; File Open or click on open folder [email protected] Setting up and Configuration 0 October 29th, 2003 05:15 PM


All times are GMT +1. The time now is 07:32 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.