Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 03-31-2011, 08:03 PM
macropod's Avatar
macropod macropod is offline Setting focus to specific word document from UserForm Windows 7 32bit Setting focus to specific word document from UserForm Office 2000
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,516
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
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Outlook userform validation help aiwnjoo Outlook 0 12-08-2010 12:57 AM
Setting focus to specific word document from UserForm Checkbox on Userform result in Text in Word Dolfie_twee Word VBA 1 06-22-2010 07:54 AM
Create Hyperlinks from Word to specific location in PDF sukanyae Word 0 02-25-2010 04:08 PM
Help with forms (shifting focus) jrh312 Word 0 11-19-2009 12:59 PM
[Word 2003] Macro's and a UserForm xanuex Word VBA 0 10-19-2009 05:42 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:18 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft