not sure if this post belongs here or not but it is concerning windows API calls.
Anyway I am trying to leverage the mouse_event of user32 however I keep gettting an error message pop up.
"Visual Basic for Applications (VBA) encountered a problem while attempting to access a property or method. The problem may be one of the following: " etc
It trips when the form first loads
Here is what I have in the form module:
CODE
Option Compare Database
Option Explicit
'**Win32 API Declarations MOUSEMOVE
Public Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)
Const MOUSEEVENTF_RIGHTDOWN = &H8
Const MOUSEEVENTF_RIGHTUP = &H10
Private Sub Form_Load()
loadHTML ("http://www.yahoo.com")
End Sub
Public Sub loadHTML(strURL As String)
'Dim strURL As String
Dim objIE As Object
Set objIE = Me.WebBrowser1.Object
objIE.Navigate strURL
End Sub
Private Sub WebBrowser1_Updated(Code As Integer)
WebBrowser1.SetFocus
'Hold left down
mouse_event MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, 0
mouse_event MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0
End Sub
Option Explicit
'**Win32 API Declarations MOUSEMOVE
Public Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)
Const MOUSEEVENTF_RIGHTDOWN = &H8
Const MOUSEEVENTF_RIGHTUP = &H10
Private Sub Form_Load()
loadHTML ("http://www.yahoo.com")
End Sub
Public Sub loadHTML(strURL As String)
'Dim strURL As String
Dim objIE As Object
Set objIE = Me.WebBrowser1.Object
objIE.Navigate strURL
End Sub
Private Sub WebBrowser1_Updated(Code As Integer)
WebBrowser1.SetFocus
'Hold left down
mouse_event MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, 0
mouse_event MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0
End Sub
Your thoughts would be appreciated.