View Single Post
 
Old 07-03-2014, 10:42 AM
ksigcajun ksigcajun is offline Windows 7 64bit Office 2010 64bit
Advanced Beginner
 
Join Date: May 2014
Posts: 76
ksigcajun is on a distinguished road
Default

Quote:
Originally Posted by gmaxey View Post
Yes you are on the right track, but ActiveX controls are not ideal for use in Word documents.

You need a range target for the text. It could be a table cell, a paragraph, a bookmark, a content control, a variables (and use a DocVariable field), etc.

Here I have created a bookmark "bmText" to serve as the target range.

Code:
Option Explicit
Dim oBM As Bookmark
Dim oRng As Range
Private Sub OptionButton111_Click()
If Me.OptionButton111.Value = True Then
   Set oRng = ActiveDocument.Bookmarks("bmText").Range
   oRng.Text = "User will email form"
   ActiveDocument.Bookmarks.Add "bmText", oRng
End If
End Sub
 
Private Sub OptionButton211_Click()
If Me.OptionButton211.Value = True Then
  Set oRng = ActiveDocument.Bookmarks("bmText").Range
   oRng.Text = "User will mail form via FedEx"
   ActiveDocument.Bookmarks.Add "bmText", oRng
End If
End Sub
This works great Greg! Thank you so much. Very helpful.

Quick question, is there a way to remove the text if someone changes their mind and wants to chose the other option button? I noticed when I do that now, it leaves the text.

Thanks!
Reply With Quote