Skip to content

Instantly share code, notes, and snippets.

@kumatti1
Created August 26, 2014 23:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kumatti1/5be491a6a75ee32457a7 to your computer and use it in GitHub Desktop.
Save kumatti1/5be491a6a75ee32457a7 to your computer and use it in GitHub Desktop.
IEでクリックされた要素を調べる
Option Explicit
'PublicNotCreatable
Public Sub htmlEvent()
Attribute hoge.VB_UserMemID = 0
'IHTMLEventObj
Dim Win2 As MSHTML.IHTMLWindow2
Set Win2 = IE.document.parentWindow
Dim objElement As MSHTML.IHTMLElement
Set objElement = Win2.event.srcElement
MsgBox objElement.Name
End Sub
Option Explicit
Public IE As Object
Option Explicit
Private Sub UserForm_Initialize()
Const url = "https://www.google.co.jp/?gws_rd=ssl"
Set IE = CreateObject("Shell.Application").Windows.findwindowSW(url, Empty, 1, 0, 1)
If IE Is Nothing Then Exit Sub
Dim cls As New Class1
IE.document.onclick = cls
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment