PDA

View Full Version : Radio Buttons entering "False" as value



saoirse
01-20-2011, 03:57 AM
Hi,

Let me start by saying that i have no idea what i'm doing - frankly i'm surprised i've managed to get as far as i have through piecing together bits of knowledge. But, i've actually managed to get my form to do what i want it to do apart from one little issue... :banghead:

Here's what i'm trying to do:
I've created a letter template in Word 2003.
There is a section of conditional text, if its a fax letter, i've got it to enter certain text into the document using the following code:Private Sub FaxOnly_Click()
If FaxOnly.Value = "True" Then
ActiveDocument.Bookmarks("FaxLtr").Range.InsertBefore "BY FACSIMILE ONLY:"
ActiveDocument.Bookmarks("PagesTxt").Range.InsertBefore "NO. OF PAGES (including this page):"
End If
End Sub

Private Sub AndFax_Click()
If AndFax.Value = "True" Then
ActiveDocument.Bookmarks("FaxLtr").Range.InsertBefore "AND BY FACSIMILE:"
ActiveDocument.Bookmarks("PagesTxt").Range.InsertBefore "NO. OF PAGES (including this page):"
End If
End Sub

So, as you might have guessed, there are two radio buttons, one labeled "By facsimile only" and the other labeled "And by facsimile". Depending upon which button is pressed, the form enters the relevant text as required.

The above code does what i want it to do, however, it also enters "True" or "False" depending upon whether one or other or neither of the buttons is selected. So if the operator selects "By facsimile only" the form enters "TRUEBy Facsimile Only" into the main document. Similarly it enters "TRUEAnd By Facsimile" if that button is selected. If neither button is selected then it enters "FALSE" into the document...

I thought i might have got it to avoid the true/false return by asking it to enter certain text if true - but it still enters "true" and then my text...

Either radio button or neither are acceptable options (it might be a mail only letter) - i simply want it to stop entering TRUE or FALSE as a result for the radio buttons.

Surely this is something really simple that i've missed...

I would be really grateful if anyone can help.

Thank you in advance,
Saoirse.

saoirse
01-20-2011, 04:00 AM
PS - i'm not sure if it matters, but the radio buttons are grouped together in a frame...

fumei
01-21-2011, 09:55 AM
Well, I duplicated - exactly - your described circumstances. The radio buttons, the code, and the text.

It does not put in "True". I can not duplicate what you describe. Could it be you have other code that you did not post?

Oh, use "Show UserForm" on the top toolbar to show the userform.

Tinbendr
01-21-2011, 11:25 AM
Turn ON all formatting marks (Word Options) and see if you don't have a stray field where the false is.

David

fumei
01-21-2011, 11:55 AM
That would mean the "True" is present before the code:
ActiveDocument.Bookmarks("FaxLtr").Range.InsertBefore "AND BY FACSIMILE:"