Word automation with VB6

H

Harlan

Using a checkbox form control on a template. I wish to control the state of
the box from my VB application. I've tried

..FormFields("check3").Result = 1
..FormFields("check3").Result = True

doesn't seem to work, and there isn't a .Value to go with .FormFields

How do you set the value of the checkbox?

Thanks
Harlan
 
J

Jonathan West

Harlan said:
Using a checkbox form control on a template. I wish to control the state of
the box from my VB application. I've tried

.FormFields("check3").Result = 1
.FormFields("check3").Result = True

doesn't seem to work, and there isn't a .Value to go with .FormFields

How do you set the value of the checkbox?

The values you need are 1 for checked, and 0 for unchecked. The Result
property is the correct property to use.
 
H

Harlan

Jonathan,
That is the value I thought I should use, but it doesn't seem to work...I
must have something set wrong.

I have a template in word and have been sucessful in "transfering" text to
form text boxes on the template using my VB application, but can't seem to
get this right. (I have protected the form)

Does the 1 have to be in " marks? Should I assign a variable the value of 1
then set the result equal to the variable?
(If only I could do use ACCESS for this application...LOL)

Thanks
Harlan
 
J

Jonathan West

Harlan said:
Jonathan,
That is the value I thought I should use, but it doesn't seem to work...I
must have something set wrong.

I have a template in word and have been sucessful in "transfering" text to
form text boxes on the template using my VB application, but can't seem to
get this right. (I have protected the form)

Ah, that's what I didn't test. When the document is protected, you need this
line of code.

ActiveDocument.FormFields("Check1").CheckBox.Value = True

I've learned something today!
 
H

Harlan

Jonathan,
Again I thank you.....works great.
And, sorry I had you stumped (for a second or two)...
Take care, have a Happy Thanksgiving (if you celebrate the holiday)
Harlan
 
H

Harlan

OOPS...guess I spoke too soon... still not working, but I figured a
workaround. On my template, I replaced the checkbox with a textbox set to
one character inside a set of parentheses. My VB application sends an X to
that textbox to show the "check"....It will have to do for now.

Thanks again Jonathan
Harlan
 

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