![]() |
|
#1
|
|||
|
|||
|
I have two option buttons for users to select one or the other.
I currently have some text with content control fields in a paragraph (bookmarked BM4) below the buttons. If a user chooses OptionButton1, it would do nothing, but keep the text present. If OptionButton2 is chosen, it would delete the text which is in Bookmark BM4. I would like OptionButton1 to not only do nothing if chosen first, but Id love for it to undo the deletion in case a user chooses OptionButton2 first and decided it wanted to keep the text and chose OptionButton1. My code in OptionButton1 isnt working properly. Any help? PHP Code:
|
|
#2
|
|||
|
|||
|
If you are using a content control (e.g., one titled "TextCC") then you don't need a bookmark for this:
Code:
Option Explicit
Private strVal As String
Private Sub OptionButton1_Click()
If Me.OptionButton1.Value = True Then
ActiveDocument.SelectContentControlsByTitle("TextCC").Item(1).Range.Text = strVal
End If
End Sub
Private Sub OptionButton2_Click()
If Me.OptionButton2.Value = True Then
strVal = ActiveDocument.SelectContentControlsByTitle("TextCC").Item(1).Range.Text
ActiveDocument.SelectContentControlsByTitle("TextCC").Item(1).Range.Text = vbNullString
End If
End Sub
|
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Option Button selected will display text | ksigcajun | Word VBA | 7 | 07-14-2014 09:31 AM |
How to run two button macros with one button?
|
Geza59 | Excel Programming | 1 | 02-14-2013 12:11 AM |
| printing option | JadePriest | Excel | 1 | 09-21-2012 10:27 AM |
| Help on option button active X | aligahk06 | Excel | 0 | 11-03-2009 11:39 PM |
| Option Button ( ACtive X Control ) | aligahk06 | Excel | 0 | 11-03-2009 06:36 AM |