Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 661
Default World map embedded in userform.

Hi,

Is it possible to embed a map into a userform? What I'm trying to accomplish
is that a map, lets say europe, is displayed and everytime when the user
clicks on the map the lat/long coordinates of the pointer are transferred to
an excel sheet.

Any ideas?

Cheers,

Paul
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default World map embedded in userform.

Indeed you can embed a an image into the entire form or probably better into
an Image control. Click the "Picture" property and browse to your image.

Set AutoSize to true and experiment with PictureSizeMode. Maybe later you
can change Autosize to false.

In the form code (assuming the image control is named Image1)

Private Sub Image1_MouseDown(ByVal Button As Integer, _
ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
Range("A1").Value = X
Range("B1").Value = Y
End Sub

Private Sub Image1_MouseMove(ByVal Button As Integer, _
ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)

Me.Caption = X & " " & Y
End Sub


You will of course need to calibrate X & Y to relate to your map
coordinates. Assuming the Grid is linear in both axes (don't assume it is),
maybe something like this

With Image1
east = (.Width / X) x (maxEast - minEast)
north = (.Height/ Y) x (maxNorth - minNorth)
End With

where max/min East/north are grid coord's at left, right top & bottom of the
map
Regards,
Peter T



"Paul" wrote in message
...
Hi,

Is it possible to embed a map into a userform? What I'm trying to
accomplish
is that a map, lets say europe, is displayed and everytime when the user
clicks on the map the lat/long coordinates of the pointer are transferred
to
an excel sheet.

Any ideas?

Cheers,

Paul



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 661
Default World map embedded in userform.

Peter,

Thanks for the reply that helps a lot just a couple of things I can't figure
out and that has mostly to do with the co-ordinates;

I've got a map, from google earth, and I'm using co-ordinates in degrees,
minutes (so 51 08N21 47E, etc etc), and I can't get the right co-ordinates to
be displayed on my map.

If I reach the top of my map one of the values states zero, but it should
state 51 degrees 08 minutes North instead of zero.

Could you help me?

Cheers,

Paul

"Peter T" wrote:

Indeed you can embed a an image into the entire form or probably better into
an Image control. Click the "Picture" property and browse to your image.

Set AutoSize to true and experiment with PictureSizeMode. Maybe later you
can change Autosize to false.

In the form code (assuming the image control is named Image1)

Private Sub Image1_MouseDown(ByVal Button As Integer, _
ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
Range("A1").Value = X
Range("B1").Value = Y
End Sub

Private Sub Image1_MouseMove(ByVal Button As Integer, _
ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)

Me.Caption = X & " " & Y
End Sub


You will of course need to calibrate X & Y to relate to your map
coordinates. Assuming the Grid is linear in both axes (don't assume it is),
maybe something like this

With Image1
east = (.Width / X) x (maxEast - minEast)
north = (.Height/ Y) x (maxNorth - minNorth)
End With

where max/min East/north are grid coord's at left, right top & bottom of the
map
Regards,
Peter T



"Paul" wrote in message
...
Hi,

Is it possible to embed a map into a userform? What I'm trying to
accomplish
is that a map, lets say europe, is displayed and everytime when the user
clicks on the map the lat/long coordinates of the pointer are transferred
to
an excel sheet.

Any ideas?

Cheers,

Paul




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 661
Default World map embedded in userform.

Peter,

Thanks for the reply that helps a lot just a couple of things I can't figure
out and that has mostly to do with the co-ordinates;

I've got a map, from google earth, and I'm using co-ordinates in degrees,
minutes (so 51 08N21 47E, etc etc), and I can't get the right co-ordinates to
be displayed on my map.

If I reach the top of my map one of the values states zero, but it should
state 51 degrees 08 minutes North instead of zero.

Could you help me?

Cheers,

Paul

"Peter T" wrote:

Indeed you can embed a an image into the entire form or probably better into
an Image control. Click the "Picture" property and browse to your image.

Set AutoSize to true and experiment with PictureSizeMode. Maybe later you
can change Autosize to false.

In the form code (assuming the image control is named Image1)

Private Sub Image1_MouseDown(ByVal Button As Integer, _
ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
Range("A1").Value = X
Range("B1").Value = Y
End Sub

Private Sub Image1_MouseMove(ByVal Button As Integer, _
ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)

Me.Caption = X & " " & Y
End Sub


You will of course need to calibrate X & Y to relate to your map
coordinates. Assuming the Grid is linear in both axes (don't assume it is),
maybe something like this

With Image1
east = (.Width / X) x (maxEast - minEast)
north = (.Height/ Y) x (maxNorth - minNorth)
End With

where max/min East/north are grid coord's at left, right top & bottom of the
map
Regards,
Peter T



"Paul" wrote in message
...
Hi,

Is it possible to embed a map into a userform? What I'm trying to
accomplish
is that a map, lets say europe, is displayed and everytime when the user
clicks on the map the lat/long coordinates of the pointer are transferred
to
an excel sheet.

Any ideas?

Cheers,

Paul




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default World map embedded in userform.

What are the grid coordinates at top left and bottom right corners. Does the
meridian intersect, Europe so I guess it does, at what distance from the
left, as a fraction of the total width (ie a decimal between 0 & 1).

What is width & height of the image (get from properties).

Double check that coord's along the centre and vertical lines are as you
would expect (ie the scales linear).

Regards,
Peter T

"Paul" wrote in message
...
Peter,

Thanks for the reply that helps a lot just a couple of things I can't
figure
out and that has mostly to do with the co-ordinates;

I've got a map, from google earth, and I'm using co-ordinates in degrees,
minutes (so 51 08N21 47E, etc etc), and I can't get the right co-ordinates
to
be displayed on my map.

If I reach the top of my map one of the values states zero, but it should
state 51 degrees 08 minutes North instead of zero.

Could you help me?

Cheers,

Paul

"Peter T" wrote:

Indeed you can embed a an image into the entire form or probably better
into
an Image control. Click the "Picture" property and browse to your image.

Set AutoSize to true and experiment with PictureSizeMode. Maybe later you
can change Autosize to false.

In the form code (assuming the image control is named Image1)

Private Sub Image1_MouseDown(ByVal Button As Integer, _
ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
Range("A1").Value = X
Range("B1").Value = Y
End Sub

Private Sub Image1_MouseMove(ByVal Button As Integer, _
ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)

Me.Caption = X & " " & Y
End Sub


You will of course need to calibrate X & Y to relate to your map
coordinates. Assuming the Grid is linear in both axes (don't assume it
is),
maybe something like this

With Image1
east = (.Width / X) x (maxEast - minEast)
north = (.Height/ Y) x (maxNorth - minNorth)
End With

where max/min East/north are grid coord's at left, right top & bottom of
the
map
Regards,
Peter T



"Paul" wrote in message
...
Hi,

Is it possible to embed a map into a userform? What I'm trying to
accomplish
is that a map, lets say europe, is displayed and everytime when the
user
clicks on the map the lat/long coordinates of the pointer are
transferred
to
an excel sheet.

Any ideas?

Cheers,

Paul








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 661
Default World map embedded in userform.

Peter,

Some has gone wrong in my last reply... I had some internet problems last
night so that might be the reason...

Indeed europe intersects, but I'm creating country maps so it doesn't affect
me that much.

the Top left coordinates from my first picture are 53 degrees 44 minutes
North / 01 degrees 38 minutes East.

Bottom right are 52 degrees 09 minutes N / 06 degrees 10 minutes East.

The heigth of my picture = 528 and the width = 966.

Can you help me out?

Cheers,

Paul.
"Peter T" wrote:

What are the grid coordinates at top left and bottom right corners. Does the
meridian intersect, Europe so I guess it does, at what distance from the
left, as a fraction of the total width (ie a decimal between 0 & 1).

What is width & height of the image (get from properties).

Double check that coord's along the centre and vertical lines are as you
would expect (ie the scales linear).

Regards,
Peter T

"Paul" wrote in message
...
Peter,

Thanks for the reply that helps a lot just a couple of things I can't
figure
out and that has mostly to do with the co-ordinates;

I've got a map, from google earth, and I'm using co-ordinates in degrees,
minutes (so 51 08N21 47E, etc etc), and I can't get the right co-ordinates
to
be displayed on my map.

If I reach the top of my map one of the values states zero, but it should
state 51 degrees 08 minutes North instead of zero.

Could you help me?

Cheers,

Paul

"Peter T" wrote:

Indeed you can embed a an image into the entire form or probably better
into
an Image control. Click the "Picture" property and browse to your image.

Set AutoSize to true and experiment with PictureSizeMode. Maybe later you
can change Autosize to false.

In the form code (assuming the image control is named Image1)

Private Sub Image1_MouseDown(ByVal Button As Integer, _
ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
Range("A1").Value = X
Range("B1").Value = Y
End Sub

Private Sub Image1_MouseMove(ByVal Button As Integer, _
ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)

Me.Caption = X & " " & Y
End Sub


You will of course need to calibrate X & Y to relate to your map
coordinates. Assuming the Grid is linear in both axes (don't assume it
is),
maybe something like this

With Image1
east = (.Width / X) x (maxEast - minEast)
north = (.Height/ Y) x (maxNorth - minNorth)
End With

where max/min East/north are grid coord's at left, right top & bottom of
the
map
Regards,
Peter T



"Paul" wrote in message
...
Hi,

Is it possible to embed a map into a userform? What I'm trying to
accomplish
is that a map, lets say europe, is displayed and everytime when the
user
clicks on the map the lat/long coordinates of the pointer are
transferred
to
an excel sheet.

Any ideas?

Cheers,

Paul






  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default World map embedded in userform.

From the info you gave it looks like your map grid is not simply rectangular
(as a street map typically is). The grid may be skewed in any one of a
number of ways. Eg longitudes not vertical and/or not parallel. Or maybe the
map is merely squashed in one direction. For some purposes it's inconvenient
that the world is spherical rather than flat !

Tp-lt 53:4n~01:38e = 53+(44/60) ~ -(1+(38/60)) = 53.73 ~ -1.633
Bt-rt 52:09n~06:10e = 52+(9/60) ~ -(6+(10/60)) = 52.15 ~ -6.167

I've omitted the calc but the horizontal/vertical ratio of these coord's is
2.86 vs the wd/ht of your image of 1.85 (966 / 528)

Will need coord's of the other corners and ideally at centre and perhaps at
the mid points of the edges.

Although it could be tedious it should be relatively straightforward to
interpolate mouse X:Y to the grid.

Regards,
Peter T





"Paul" wrote in message
...
Peter,

Some has gone wrong in my last reply... I had some internet problems last
night so that might be the reason...

Indeed europe intersects, but I'm creating country maps so it doesn't
affect
me that much.

the Top left coordinates from my first picture are 53 degrees 44 minutes
North / 01 degrees 38 minutes East.

Bottom right are 52 degrees 09 minutes N / 06 degrees 10 minutes East.

The heigth of my picture = 528 and the width = 966.

Can you help me out?

Cheers,

Paul.
"Peter T" wrote:

What are the grid coordinates at top left and bottom right corners. Does
the
meridian intersect, Europe so I guess it does, at what distance from the
left, as a fraction of the total width (ie a decimal between 0 & 1).

What is width & height of the image (get from properties).

Double check that coord's along the centre and vertical lines are as you
would expect (ie the scales linear).

Regards,
Peter T

"Paul" wrote in message
...
Peter,

Thanks for the reply that helps a lot just a couple of things I can't
figure
out and that has mostly to do with the co-ordinates;

I've got a map, from google earth, and I'm using co-ordinates in
degrees,
minutes (so 51 08N21 47E, etc etc), and I can't get the right
co-ordinates
to
be displayed on my map.

If I reach the top of my map one of the values states zero, but it
should
state 51 degrees 08 minutes North instead of zero.

Could you help me?

Cheers,

Paul

"Peter T" wrote:

Indeed you can embed a an image into the entire form or probably
better
into
an Image control. Click the "Picture" property and browse to your
image.

Set AutoSize to true and experiment with PictureSizeMode. Maybe later
you
can change Autosize to false.

In the form code (assuming the image control is named Image1)

Private Sub Image1_MouseDown(ByVal Button As Integer, _
ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
Range("A1").Value = X
Range("B1").Value = Y
End Sub

Private Sub Image1_MouseMove(ByVal Button As Integer, _
ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)

Me.Caption = X & " " & Y
End Sub


You will of course need to calibrate X & Y to relate to your map
coordinates. Assuming the Grid is linear in both axes (don't assume it
is),
maybe something like this

With Image1
east = (.Width / X) x (maxEast - minEast)
north = (.Height/ Y) x (maxNorth - minNorth)
End With

where max/min East/north are grid coord's at left, right top & bottom
of
the
map
Regards,
Peter T



"Paul" wrote in message
...
Hi,

Is it possible to embed a map into a userform? What I'm trying to
accomplish
is that a map, lets say europe, is displayed and everytime when the
user
clicks on the map the lat/long coordinates of the pointer are
transferred
to
an excel sheet.

Any ideas?

Cheers,

Paul








Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
error with userform, "unable to create embedded object" Jeff Excel Programming 4 November 1st 05 07:44 PM
Userform Image Control and embedded images tim Excel Programming 13 April 5th 05 01:32 PM
Displaying embedded chart on userform Bill Renaud[_2_] Excel Programming 2 April 6th 04 11:16 AM
Chart embedded in UserForm Tim[_21_] Excel Programming 2 September 10th 03 11:13 AM
unable to create embedded object on a userform Robert Nobles Excel Programming 0 September 9th 03 08:49 PM


All times are GMT +1. The time now is 07:35 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"