View Single Post
 
Old 03-31-2011, 08:03 PM
macropod's Avatar
macropod macropod is offline Windows 7 32bit Office 2000
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Hi SaneMan,

Assuming your Userform is supposed to update its own document only, the simple solution is to use 'ThisDocument' instead of 'ActiveDocument'. Alternatively, you could set a reference to the document when the UserForm is first opened, then use that for subsequent updates. For example:
Code:
Option Explicit
Dim DocFrm As Document
 
Private Sub UserForm_Initialize()
Set DocFrm = ThisDocument
End Sub
 
Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
With DocFrm
'code to update the document goes here
End With
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote