Populating checkboxes from saved values

L

liz

I have a userform (in Word) Initially it runs successfully and fields
stored as custom field sin file properties are updated as expected. I
need to be able to rerun the userform to allow update, relatively
simple I thought. Yes, it all works except for the checkbox items. I
have tried custom fields defined as text and yes/no and although they
are initially updated I can't retreive the data when I rerun the
userform I get a run time error 5 invalid procedure. Do I need to do
something special to get the -1 and 0 (yes and no) to populate the
check boxes?

luca
 
D

Doug Robbins - Word MVP

Use a MsgBox statement to find out what is actually stored in the respective
custom fields (I am not really sure what you mean by that - Document
Variables or Custom Document Properties?)

You may then need to use and If... Else...End If construction to covert that
data to boolean True or False for the checkbox.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
L

liz

Use a MsgBox statement to find out what is actually stored in the respective
custom fields (I am not really sure what you mean by that - Document
Variables or Custom Document Properties?)

You may then need to use and If... Else...End If construction to covert that
data to boolean True or False for the checkbox.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

Doug,

I will try that, although I already know (visually) that the custom
fileds - yes, I mean the custom document properties hold -1 or 0 if
they are defined as text fields. If they are yes/no I'm not sure but I
would guess the underlying values would be the same since that is the
convention. Mingd you I also know that my debug statements for the
initial execution of the userform report the values as True & False,
but I have always understood that these are held as -1 and 0. It
doesn't make sense to me that I can set the values using the user form
and there are no reported erros and the values look OK, but to
redisplay the exact thing it has just saved doesn't work and my need
some sort of manipulation?!

Anyway I will have another go...

Luca
 
D

Doug Robbins - Word MVP

It appears that you need to set the .Value of the check box to either "True"
or "False" - without the quotes. Setting to either -1 or 0, while it causes
a tick to be displayed in the checkbox, does not really result in the .Value
of the checkbox being set as a subsequent

MsgBox CheckBox1.Value

returns and invalid use of Null error message and that is what the checkbox
is actually set to if you hover over it after going to Debug.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 

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