You will need to add a reference in to the Chart Object library. In the VBE window, use
Tools | References from the menu and select Microsoft Graph 12.0 Object Library. Mark the
check box and click OK.
Enter the module for your form and add the following code to the declarations section at
the top of the module:
Private Type POINTAPI
x As Long
y As Long
End Type
Private Declare Function GetCursorPos Lib "user 32 " _
(lpPoint As POINTAPI) As Long
Private Declare Function GetPixel Lib "gdi 32 " _
(ByVal hdc As Long, ByVal x As Long, ByVal y As Long) As Long
Private Declare Function GetWindowDC Lib "user 32 " (ByVal hwnd As Long) _
As Long
This will set up a new data type called POINTAPI and generate declarations for three API
calls:GetCursorPos,GetPixel, andGetWindowDC.
On the form module, click the drop-down in the top-left corner and select the graph
object. Add the following code to the Mouse Down event for the graph:
Private SubGraph0_MouseDown(ButtonAsInteger,ShiftAsInteger,xAs Single,_
y As Single)
Dim cPos As POINTAPI, Temp1 As Long, Temp2 As Long, Pointcount As Integer
Dim ch As Graph.Chart, PCol As Long
Call GetCursorPos(cPos)
Temp = GetWindowDC( 0 )
Temp1 = cPos.x
Temp2 = cPos.y
326 Microsoft Access 2010 VBA Macro Programming
Currency Value
USD 1627.89
GBP 4533.21
EUR 3445.67
AUD 3289.45
HKD 3345.56
Table 34-1 Currency Table Values