-
Set focus on document from Userform
With reference to my MergeField Select KB entry, I would like it to "Set Focus" to the document after a mergefield is added. The code to add the field is :
MD
[VBA]
Private Sub ListBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
'Add listbox item to document
ActiveDocument.Fields.Add Range:=Selection.Range, Type:=wdFieldMergeField _
, Text:=ListBox1
End Sub
[/VBA]
MVP (Excel 2008-2010)
Post a workbook with sample data and layout if you want a quicker solution.
To help indent your macros try Smart Indent
Please remember to mark threads 'Solved'
-
Can you just unload/hide the User Form or are you trying to do something else?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules