Results 1 to 2 of 2
  1. #1
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Glasgow, Scotland
    Posts
    137
    Thanks
    0
    Thanked 0 Times in 0 Posts

    DropDown Form Field

    I have two values in a a drop down field. If value 1 is selected I want to insert some text in the bookmark "s1" if value 2 is selected I want to insert some different text in the same bookmark. Can someone please provide me with some code to complete this.

    many thanks

    Regards

    John

  2. #2
    Platinum Lounger
    Join Date
    Dec 2000
    Location
    Queanbeyan, New South Wales, Australia
    Posts
    3,730
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: DropDown Form Field

    You would need something like:
    <pre>Sub PopulateText()
    ActiveDocument.Unprotect
    If ActiveDocument.FormFields("Dropdown1").Result = 1 Then
    ActiveDocument.Bookmarks("Bookmark1").Range.Text = "AA"
    Else
    ActiveDocument.Bookmarks("Bookmark1").Range.Text = "BB"
    End If
    ActiveDocument.Protect Type:=wdAllowOnlyFormFields, _
    noreset:=True
    End Sub
    </pre>


    Then double click on the dropdown box while the document is unprotected. Enter "PopulateText" into the "Run macro on exit.
    Subway Belconnen- home of the Signboard to make you smile. Get (almost) daily updates- follow SubwayBelconnen on Twitter.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •