Last active
June 19, 2024 12:34
-
-
Save mburbea/5300f41173a2eaae477dc4eb7cc69db1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
VERSION 1.0 CLASS | |
BEGIN | |
MultiUse = -1 'True | |
END | |
Attribute VB_Name = "XmlMonitor" | |
Attribute VB_GlobalNameSpace = False | |
Attribute VB_Creatable = False | |
Attribute VB_PredeclaredId = True | |
Attribute VB_Exposed = False | |
Option Explicit | |
const monitorId as string = "MonitorChannel" | |
Dim WithEvents parts as CustomXMLParts | |
Private Sub Class_Initialize() | |
Set parts = ActiveWorkbook.CustomXmlParts | |
If parts.SelectByNameSpace(monitorId).Count = 0 then | |
'create a name space element so that the javascript has something to play with. | |
parts.add "<empty xmlns='"& monitorId & "'/>" | |
End If | |
End Sub | |
private sub parts_PartAfterLoad(ByVal part as CustomXmlPart) | |
if part.NameSpaceURI = monitorId then | |
MsgBox("msg from officeJS!" & cstr(part.xml)) | |
end if | |
end sub | |
public property Get Channel() As String | |
Channel = monitorId | |
end property |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment