Set map size in VB

Microsoft MapPoint


I am trying to set the size of a map in MapPoint 2002 using VB. I want to
always have maps that are 600 wide by 500 high. The only way that I've
found to do this is by setting the size of the MapPoint application:

'Set the height and width of the application
MPApp.Height = 590
MPApp.Width = 816

and using the following:

MsgBox ("Width: " & oMap.Width & " Height: " & oMap.Height)

to see what the current map height and width are. Doing a little math I
figured out what size to set the application to, but this is just a hack and
I want to make sure that it *always* works. Is there a way to set the map
height and width? The properties appear to be read only....


Jason Tabert
Student, University of Washington, Informatics
I don't think you can influence the size of the application window by
setting the size of one of its components, the map.

Unfortunately, trying to get the map size just right by adapting the
size of the application window does not work achieve the desired
results, at least not immediately. An iterative approach seems to work
though - here's what I was able to come up with. The Sub computes the
difference between current and desired map size, and "nudges" the
application window in the corresponding direction. It stops either
when the goal is achieved, or (to prevent a potential endless loop)
after five iterations:

Private Sub Command1_Click()
Dim dx As Integer
Dim dy As Integer
Dim nCount As Integer

nCount = 5
dx = 600 - oMap.Width
dy = 500 - oMap.Height
oMpApp.Width = oMpApp.Width + dx
oMpApp.Height = oMpApp.Height + dy
nCount = nCount - 1
Loop While (dx <> 0 Or dy <> 0) And nCount > 0
End Sub

Gilles [MVP].

(Please reply to the group, not via email)
That works great! Thanks!