Consulting

Results 1 to 2 of 2

Thread: Set focus on document from Userform

  1. #1
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location

    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'

  2. #2
    Site Admin
    Jedi Master
    VBAX Guru Jacob Hilderbrand's Avatar
    Joined
    Jun 2004
    Location
    Roseville, CA
    Posts
    3,712
    Location
    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
  •