![]() |
|
#1
|
||||
|
||||
![]()
Inserting the new item is easy enough, but you also need to be able to delete it again if the user changes the dropdown selection. The following code should suffice. See attached demo.
Code:
Sub OptTxtFmFld() Dim Prot As Variant, BmkRng As Range Const Pwd As String = "" 'Insert password here Const BmkNm As String = "BkMk" ' The bookmark name With ActiveDocument Prot = .ProtectionType If .ProtectionType <> wdNoProtection Then Prot = .ProtectionType .Unprotect Password:=Pwd End If If .Bookmarks.Exists(BmkNm) Then Set BmkRng = .Bookmarks(BmkNm).Range If .FormFields("Dropdown1").Result = "1000" Then .FormFields.Add BmkRng, wdFieldFormTextInput Else BmkRng.Delete End If .Bookmarks.Add BmkNm, BmkRng Else MsgBox "Bookmark: " & BmkNm & " not found." End If .Protect Type:=Prot, Password:=Pwd, NoReset:=True End With Set BmkRng = Nothing End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#2
|
|||
|
|||
![]()
So what you are saying is that this code should be added to the exit macro of the drop-down menu?
|
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
Jamal NUMAN | Excel | 16 | 11-15-2022 11:59 PM |
Countif statements | Alaska1 | Excel | 5 | 02-05-2015 07:55 PM |
![]() |
stuwoolf | Excel | 2 | 01-10-2015 01:58 PM |
![]() |
Alaska1 | Excel | 1 | 05-14-2014 08:21 AM |
IF statements that shifts to right. | kent | Excel | 0 | 01-19-2006 02:23 PM |