View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
PBezucha PBezucha is offline
external usenet poster
 
Posts: 120
Default Marking points read for coordinates

Peter,
It's pleasure to work with you. The previous version appeared flowless.
As I take it, the new one is corrected to avoid API calls that may have
vanished in xl2007 (I haven't it also to prove)? I'll try the change.
Regards

--
Petr Bezucha


"Peter T" wrote:

Petr, try this -

Private Sub GetCoordinates()
'Action sub deployed by clicking the ActionKey.
Dim P As Range, PN As String, XPos As Long, YPos As Long
Dim shp As Shape

GetCursorPos Pos
On Error GoTo CancelOnKey
'Target cell
Set P = Worksheets(SN).Cells(R, C)
If Not IsEmpty(P) Then
Exit Sub
End If
'Record
XPos = Pos.x
YPos = Pos.y

With ActiveWindow
XPos = (XPos - .PointsToScreenPixelsX(0)) * 100 / .Zoom
YPos = (YPos - .PointsToScreenPixelsY(0)) * 100 / .Zoom
' this might not accurately correct zoom
End With

' include "add comment" code here if required from original

' If AddPointDeck Then

XPos = 0.75 * XPos
YPos = 0.75 * YPos

XPos = XPos - TargetMarkerSize / 2
YPos = YPos - TargetMarkerSize / 2

Set shp = ActiveSheet.Shapes.AddShape(msoShapeOval, XPos, YPos, _
TargetMarkerSize, TargetMarkerSize)
With shp
.Fill.Visible = msoTrue
.Fill.Solid
.Fill.ForeColor.SchemeColor = TargetMarkerColor
.Fill.Transparency = 0.5
.Line.Visible = msoFalse
.LockAspectRatio = msoTrue
End With
' End If
'==============================
R = R + 1
Exit Sub
CancelOnKey:
xyReadingFinish
End Sub

Regards,
Peter T



"PBezucha" wrote in message
...
Hi Peter,

Thank you for the dream cooperation. I will work on the proposed changes
over the weekend so as to create the best of us, and tell back.
It's pity that the Excel users out of economical rank have relatively
scarce
web contact. I think the miracles for the lower and middle level users
from
technical branches can be accomplished, provided somebody helps people to
get
over some obstacles that seem at the first sight to eliminate Excel in
favor
of incommensurate and expensive other applications.

Regards,
--
Petr Bezucha