VERSION 1.0 CLASS BEGIN MultiUse = -1 'True Persistable = 0 'NotPersistable DataBindingBehavior = 0 'vbNone DataSourceBehavior = 0 'vbNone MTSTransactionMode = 0 'NotAnMTSObject END Attribute VB_Name = "UserInfo" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = False Attribute VB_Exposed = False Option Explicit ' Save info about global user info setting and ensure it is reset Dim bInitialized As Boolean Dim m_App As Object Dim m_UserName As String Private Sub Class_Initialize() bInitialized = False End Sub Public Sub SaveContext(app As Object, OApp As OfficeApp) Dim T As Tracker: Set T = GStackTrace.Enter(TypeName(Me), "SaveContext") Dim CurrDoc As Word.Document If OApp.IsWord() Then bInitialized = True Set m_App = app m_UserName = app.UserName End If End Sub Public Sub RestoreContext() Dim T As Tracker: Set T = GStackTrace.Enter(TypeName(Me), "RestoreContext") If bInitialized Then bInitialized = False m_App.UserName = m_UserName End If End Sub Private Sub Class_Terminate() Dim T As Tracker: Set T = GStackTrace.Enter(TypeName(Me), "Class_Terminate") If bInitialized Then ' Only if not already restored m_App.UserName = m_UserName End If End Sub