Dr@g0nfly
02-21-2007, 12:51 PM
HI there, my very first post. I was modifying one of the code samples I found here uploaded by fumei (article 754). The only change I needed was to make the text APPEAR when the checkmark is chosen and HIDE when it is not. I changed the bookmark text to hidden and switched around the arguments to look like this:
Option Explicit
Private Sub ExCstID_Change()
Call ExistingCustomer
End Sub
Private Sub NExCstID_Change()
Call NoExistingCustomer
End Sub
Sub ExistingCustomer()
Dim orange As Range
Set orange = ActiveDocument.Bookmarks("ExstCustID").Range
If ExCstID.Value = True Then
With orange.Font
.Hidden = False
End With
With ActiveWindow.View
.ShowHiddenText = True
.ShowAll = False
End With
Else
With orange.Font
.Hidden = True
End With
With ActiveWindow.View
.ShowHiddenText = False
.ShowAll = False
End With
End If
End Sub
Sub NoExistingCustomer()
Dim orange As Range
Set orange = ActiveDocument.Bookmarks("NExstCustID").Range
If NExCstID.Value = True Then
With orange.Font
.Hidden = False
End With
With ActiveWindow.View
.ShowHiddenText = True
.ShowAll = False
End With
Else
With orange.Font
.Hidden = True
End With
With ActiveWindow.View
.ShowHiddenText = False
.ShowAll = False
End With
End If
End Sub
The first checkbox is a Yes checkbox to the question "Is there an existing Customer ID you would like to attach this account to?" [or some variation of that sort] and the next checkmark is NO. I need text to appear in both cases, whether they select yes or no but it seems like this code uncovers every bookmark in the document when I click every option (yes & no). I need the show property to be more discriminating. I know this must be simple to experienced programmers but I'm lost! I've only really programmed VBA in Access... Word is a little out of my field.:think:
Thanks for the help!: pray2:
~C
added code tags ~Tommy
Option Explicit
Private Sub ExCstID_Change()
Call ExistingCustomer
End Sub
Private Sub NExCstID_Change()
Call NoExistingCustomer
End Sub
Sub ExistingCustomer()
Dim orange As Range
Set orange = ActiveDocument.Bookmarks("ExstCustID").Range
If ExCstID.Value = True Then
With orange.Font
.Hidden = False
End With
With ActiveWindow.View
.ShowHiddenText = True
.ShowAll = False
End With
Else
With orange.Font
.Hidden = True
End With
With ActiveWindow.View
.ShowHiddenText = False
.ShowAll = False
End With
End If
End Sub
Sub NoExistingCustomer()
Dim orange As Range
Set orange = ActiveDocument.Bookmarks("NExstCustID").Range
If NExCstID.Value = True Then
With orange.Font
.Hidden = False
End With
With ActiveWindow.View
.ShowHiddenText = True
.ShowAll = False
End With
Else
With orange.Font
.Hidden = True
End With
With ActiveWindow.View
.ShowHiddenText = False
.ShowAll = False
End With
End If
End Sub
The first checkbox is a Yes checkbox to the question "Is there an existing Customer ID you would like to attach this account to?" [or some variation of that sort] and the next checkmark is NO. I need text to appear in both cases, whether they select yes or no but it seems like this code uncovers every bookmark in the document when I click every option (yes & no). I need the show property to be more discriminating. I know this must be simple to experienced programmers but I'm lost! I've only really programmed VBA in Access... Word is a little out of my field.:think:
Thanks for the help!: pray2:
~C
added code tags ~Tommy