LiteView2 Object Model Reference
Complete API reference for the LiteView2 WebView2 ActiveX control
LiteView2 API Architecture
LiteView2Lib
|
+-- IBrowserPool (Multi-browser, reg-free pattern)
| coclass: BrowserPool
| All methods take browserIndex As Long
|
+-- ILiteView2Ctrl (Single-browser, design-time OCX)
| coclass: LiteView2Ctrl
| No browserIndex — operates on embedded WebView
|
+-- ILV2Json (Standalone JSON engine — no WebView2 required)
| coclass: LiteView2Json
| CreateObject("LiteView2.Json") — works in any VBA host
|
+-- _DLiteView2CtrlEvents (Event dispinterface)
| Source of all OCX events
|
+-- _LiteView2Ctrl (Pure dispatch mirror)
Default interface for Access IntelliSense
Choosing the Right Interface for Your VBA Project
| Pattern | Interface | When |
|---|---|---|
| Design-Time OCX | ILiteView2Ctrl | Drop OCX on Access/Excel/VB6 form. Single browser per control. Events via LiteView2Ctrl1_EventName. |
| BrowserPool | IBrowserPool | Multiple browsers, reg-free, Access Frame embedding. Events via SetWebMessageCallback. |
| JSON Engine | ILV2Json | Standalone JSON parsing and manipulation. No browser or WebView2 required. Three performance tiers: stateless, DOM handle, compiled path. |
Key difference: IBrowserPool methods all take browserIndex (Long) as first parameter. ILiteView2Ctrl methods omit it. ILV2Json requires no browser at all — activate with CreateObject("LiteView2.Json").
Important VBA Integration Rules
ILV2Json works without WebView2 in any VBA host — use CreateObject("LiteView2.Json"). JSON helper methods on ILiteView2Ctrl and IBrowserPool are also safe to call from any event handler, including WebMessageReceived.
Always use late binding (Private m_lv As Object) for design-time OCX to avoid Err 91 on first form open.
Primary readiness signal is the WebViewReady event. IsReady is a polling fallback only.
Getting Started with WebView2 in VBA (5-Line Pattern)
The basic design-time OCX pattern used across all production demos — works in Access, Excel, and VB6:
' Late-bound pattern — avoids type library dependency
Private m_lv As Object
Private Sub Form_Load()
On Error Resume Next
Set m_lv = Me.Controls("LiteView2Ctrl1").Object
On Error GoTo 0
End Sub
Private Sub LiteView2Ctrl1_WebViewReady()
m_lv.SetLocalContentRoot CurrentProject.Path & "\html"
m_lv.Navigate "https://lv2.local/index.html"
End Sub
Source: Proven pattern from production demos