how to add checkboxes values to bookmarks

H

Haroon

hi

i have few check boxes on the form, i want to display the text of textboxes
to be displayed on bookmarks when user preses Submit button.

anyone got ideas?

thanks in advance :)
 
G

Greg Maxey

You really need to put a little more effort into describing what it is that
you really want to do.

In the subject you ask how to add checkboxes values to bookmarks. In the
body of your message you state "i want to display the text of textboxes to
be displayed on bookmarks when user preses Submit button."

When you make up your mind I am sure that one of us will be able to help.
 
H

Haroon

sorry about that Greg,

bascially, i have created a form in vba/word (word 2003) with 2 check boxes.
I want users to select a checkbox and the value of that checkbox gets
populated in one of the bookmarks on the doucment.

e.g.
text1 []
text2 []

user selects text2 checkbox
the value of that text2 gets placed in bookmark on the document as same
name, e.g. text2.

hope i make sense this time :)
 
G

Greg Maxey

Name your bookmarks chkBox1 and chkBox2

Private Sub comOK_Click()
Dim oBMs As Bookmarks
Dim oRng As Word.Range
Set oBMs = ActiveDocument.Bookmarks
Set oRng = oBMs("ChkBox1").Range
If Me.CheckBox1.Value Then
oRng.Text = "True"
Else
oRng.Text = "False"
End If
oBMs.Add "ChkBox1", oRng
Set oRng = oBMs("ChkBox2").Range
If Me.CheckBox2.Value Then
oRng.Text = "True"
Else
oRng.Text = "False"
End If
oBMs.Add "ChkBox2", oRng
Me.Hide
End Sub


sorry about that Greg,

bascially, i have created a form in vba/word (word 2003) with 2 check
boxes. I want users to select a checkbox and the value of that
checkbox gets populated in one of the bookmarks on the doucment.

e.g.
text1 []
text2 []

user selects text2 checkbox
the value of that text2 gets placed in bookmark on the document as
same name, e.g. text2.

hope i make sense this time :)


Greg Maxey said:
You really need to put a little more effort into describing what it
is that you really want to do.

In the subject you ask how to add checkboxes values to bookmarks.
In the body of your message you state "i want to display the text of
textboxes to be displayed on bookmarks when user preses Submit
button."

When you make up your mind I am sure that one of us will be able to
help.
 
H

Haroon

thanks Greg, you are a genius :)

Greg Maxey said:
Name your bookmarks chkBox1 and chkBox2

Private Sub comOK_Click()
Dim oBMs As Bookmarks
Dim oRng As Word.Range
Set oBMs = ActiveDocument.Bookmarks
Set oRng = oBMs("ChkBox1").Range
If Me.CheckBox1.Value Then
oRng.Text = "True"
Else
oRng.Text = "False"
End If
oBMs.Add "ChkBox1", oRng
Set oRng = oBMs("ChkBox2").Range
If Me.CheckBox2.Value Then
oRng.Text = "True"
Else
oRng.Text = "False"
End If
oBMs.Add "ChkBox2", oRng
Me.Hide
End Sub


sorry about that Greg,

bascially, i have created a form in vba/word (word 2003) with 2 check
boxes. I want users to select a checkbox and the value of that
checkbox gets populated in one of the bookmarks on the doucment.

e.g.
text1 []
text2 []

user selects text2 checkbox
the value of that text2 gets placed in bookmark on the document as
same name, e.g. text2.

hope i make sense this time :)


Greg Maxey said:
You really need to put a little more effort into describing what it
is that you really want to do.

In the subject you ask how to add checkboxes values to bookmarks.
In the body of your message you state "i want to display the text of
textboxes to be displayed on bookmarks when user preses Submit
button."

When you make up your mind I am sure that one of us will be able to
help.

Haroon wrote:
hi

i have few check boxes on the form, i want to display the text of
textboxes to be displayed on bookmarks when user preses Submit
button.

anyone got ideas?

thanks in advance :)
 
H

Haroon

is it possible to populate the bookmark with the caption of the textbox?

Greg Maxey said:
Name your bookmarks chkBox1 and chkBox2

Private Sub comOK_Click()
Dim oBMs As Bookmarks
Dim oRng As Word.Range
Set oBMs = ActiveDocument.Bookmarks
Set oRng = oBMs("ChkBox1").Range
If Me.CheckBox1.Value Then
oRng.Text = "True"
Else
oRng.Text = "False"
End If
oBMs.Add "ChkBox1", oRng
Set oRng = oBMs("ChkBox2").Range
If Me.CheckBox2.Value Then
oRng.Text = "True"
Else
oRng.Text = "False"
End If
oBMs.Add "ChkBox2", oRng
Me.Hide
End Sub


sorry about that Greg,

bascially, i have created a form in vba/word (word 2003) with 2 check
boxes. I want users to select a checkbox and the value of that
checkbox gets populated in one of the bookmarks on the doucment.

e.g.
text1 []
text2 []

user selects text2 checkbox
the value of that text2 gets placed in bookmark on the document as
same name, e.g. text2.

hope i make sense this time :)


Greg Maxey said:
You really need to put a little more effort into describing what it
is that you really want to do.

In the subject you ask how to add checkboxes values to bookmarks.
In the body of your message you state "i want to display the text of
textboxes to be displayed on bookmarks when user preses Submit
button."

When you make up your mind I am sure that one of us will be able to
help.

Haroon wrote:
hi

i have few check boxes on the form, i want to display the text of
textboxes to be displayed on bookmarks when user preses Submit
button.

anyone got ideas?

thanks in advance :)
 
G

Greg Maxey

Yes.

Private Sub comOK_Click()
Dim oBMs As Bookmarks
Dim oRng As Word.Range
Set oBMs = ActiveDocument.Bookmarks
Set oRng = oBMs("ChkBox1").Range
If Me.CheckBox1.Value Then
oRng.Text = Me.CheckBox1.Caption
Else
oRng.Text = ""
End If
oBMs.Add "ChkBox1", oRng
Set oRng = oBMs("ChkBox2").Range
If Me.CheckBox2.Value Then
oRng.Text = Me.CheckBox2.Caption
Else
oRng.Text = ""
End If
oBMs.Add "ChkBox2", oRng
Me.Hide
End Sub

is it possible to populate the bookmark with the caption of the
textbox?

Greg Maxey said:
Name your bookmarks chkBox1 and chkBox2

Private Sub comOK_Click()
Dim oBMs As Bookmarks
Dim oRng As Word.Range
Set oBMs = ActiveDocument.Bookmarks
Set oRng = oBMs("ChkBox1").Range
If Me.CheckBox1.Value Then
oRng.Text = "True"
Else
oRng.Text = "False"
End If
oBMs.Add "ChkBox1", oRng
Set oRng = oBMs("ChkBox2").Range
If Me.CheckBox2.Value Then
oRng.Text = "True"
Else
oRng.Text = "False"
End If
oBMs.Add "ChkBox2", oRng
Me.Hide
End Sub


sorry about that Greg,

bascially, i have created a form in vba/word (word 2003) with 2
check boxes. I want users to select a checkbox and the value of that
checkbox gets populated in one of the bookmarks on the doucment.

e.g.
text1 []
text2 []

user selects text2 checkbox
the value of that text2 gets placed in bookmark on the document as
same name, e.g. text2.

hope i make sense this time :)


:

You really need to put a little more effort into describing what it
is that you really want to do.

In the subject you ask how to add checkboxes values to bookmarks.
In the body of your message you state "i want to display the text
of textboxes to be displayed on bookmarks when user preses Submit
button."

When you make up your mind I am sure that one of us will be able to
help.

Haroon wrote:
hi

i have few check boxes on the form, i want to display the text of
textboxes to be displayed on bookmarks when user preses Submit
button.

anyone got ideas?

thanks in advance :)
 
H

Haroon

thanks Greg, your a star *

Greg Maxey said:
Yes.

Private Sub comOK_Click()
Dim oBMs As Bookmarks
Dim oRng As Word.Range
Set oBMs = ActiveDocument.Bookmarks
Set oRng = oBMs("ChkBox1").Range
If Me.CheckBox1.Value Then
oRng.Text = Me.CheckBox1.Caption
Else
oRng.Text = ""
End If
oBMs.Add "ChkBox1", oRng
Set oRng = oBMs("ChkBox2").Range
If Me.CheckBox2.Value Then
oRng.Text = Me.CheckBox2.Caption
Else
oRng.Text = ""
End If
oBMs.Add "ChkBox2", oRng
Me.Hide
End Sub

is it possible to populate the bookmark with the caption of the
textbox?

Greg Maxey said:
Name your bookmarks chkBox1 and chkBox2

Private Sub comOK_Click()
Dim oBMs As Bookmarks
Dim oRng As Word.Range
Set oBMs = ActiveDocument.Bookmarks
Set oRng = oBMs("ChkBox1").Range
If Me.CheckBox1.Value Then
oRng.Text = "True"
Else
oRng.Text = "False"
End If
oBMs.Add "ChkBox1", oRng
Set oRng = oBMs("ChkBox2").Range
If Me.CheckBox2.Value Then
oRng.Text = "True"
Else
oRng.Text = "False"
End If
oBMs.Add "ChkBox2", oRng
Me.Hide
End Sub



Haroon wrote:
sorry about that Greg,

bascially, i have created a form in vba/word (word 2003) with 2
check boxes. I want users to select a checkbox and the value of that
checkbox gets populated in one of the bookmarks on the doucment.

e.g.
text1 []
text2 []

user selects text2 checkbox
the value of that text2 gets placed in bookmark on the document as
same name, e.g. text2.

hope i make sense this time :)


:

You really need to put a little more effort into describing what it
is that you really want to do.

In the subject you ask how to add checkboxes values to bookmarks.
In the body of your message you state "i want to display the text
of textboxes to be displayed on bookmarks when user preses Submit
button."

When you make up your mind I am sure that one of us will be able to
help.

Haroon wrote:
hi

i have few check boxes on the form, i want to display the text of
textboxes to be displayed on bookmarks when user preses Submit
button.

anyone got ideas?

thanks in advance :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top