View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected] rons@bedfordplastics.com is offline
external usenet poster
 
Posts: 3
Default State Map, Mouse Position Question

Greetings,

Using Excel 2003, have a userform with an image of the US States.
What's a good way to show which state i am hovering over and have a
mouse click event return the state name.

I was trying to use the mouse move x, y, but this only works for me if
the state is semi-square, unsure how to do it for Texas, California,
Idaho, etc.


code snipet...
Private Sub Image1_MouseMove(ByVal Button As Integer, ByVal Shift As
Integer, ByVal X As Single, ByVal Y As Single)
If Xval = 35 And Xval <= 51 And YVal = 16 And YVal <= 24 Then
UserForm1.Caption = "Washington"
Else

If Xval = 32.25 And Xval <= 59 And YVal = 38.25 And YVal <= 56 Then
UserForm1.Caption = "Oregon"
Else
UserForm1.Caption = X & " XVal" & " " & Y & " YVal"
End IF
End If

Thank you
RonS