(Msg. 1) Posted: Sat Jul 19, 2008 3:05 pm
Post subject: Issue assigning checkbox caption Add to elertz Archived from groups: microsoft>public>word>vba>userforms (more info?)
Hi.
I am endeavouring to reflect the caption name of a number of check boxes as
bookmark entries from a document. (In the form.initialize event.)
i.e. ChkWPDW1 caption = bmWPDW1(bookmark).value, and do the same for up to 7
check boxes within a frame/
I have got as far as the code below, however I get the following message
"The requested member of the collection does not exist."
Please can you tell me if this method is possible and, if so what is causing
the issue from the code below.
Thank you for your consideration.
Al@n
Dim Name$, MyString
For Each ctl In fraWorksWPD.Controls
If Left(ctl.Name, 3) = "chk" Then
MyString = ctl.Name
Name$ = Mid(MyString, 4)
ctl.Caption= ActiveDocument.Bookmarks("bm &
Name$").Range.Text
End If
Next ctl
End With
(Msg. 2) Posted: Sat Jul 19, 2008 3:05 pm
Post subject: Re: Issue assigning checkbox caption Add to elertz [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
On Sat, 19 Jul 2008 15:05:31 +0100, "Al@n" <@l@n@gawsi.freeserve.co.uk> wrote:
>Hi.
>
>I am endeavouring to reflect the caption name of a number of check boxes as
>bookmark entries from a document. (In the form.initialize event.)
>i.e. ChkWPDW1 caption = bmWPDW1(bookmark).value, and do the same for up to 7
>check boxes within a frame/
>
>I have got as far as the code below, however I get the following message
>"The requested member of the collection does not exist."
>
>Please can you tell me if this method is possible and, if so what is causing
>the issue from the code below.
>
>Thank you for your consideration.
>
>Al@n
>
>Dim Name$, MyString
>For Each ctl In fraWorksWPD.Controls
> If Left(ctl.Name, 3) = "chk" Then
> MyString = ctl.Name
> Name$ = Mid(MyString, 4)
> ctl.Caption= ActiveDocument.Bookmarks("bm &
>Name$").Range.Text
> End If
>Next ctl
>End With
You need to keep in mind the distinction between string variables and literals,
and the way double quotes are used to indicate literals.
The bookmark name you're trying to use in the current code is the literal string
"bm & Name$"
where the characters " & Name$" are part of the literal. What you want instead
is
"bm" & Name$
--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit.
(Msg. 3) Posted: Sat Jul 19, 2008 8:49 pm
Post subject: Re: Issue assigning checkbox caption Add to elertz [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
Jay
Thank you very much, so simple and obvious but I couldn't see it for
looking.
Thanks Again
Al@n
"Jay Freedman" <jay.freedman DeleteThis @verizon.net> wrote in message
news:inu38454l3k85tai4vkokia00ko13rmbaj@4ax.com...
> On Sat, 19 Jul 2008 15:05:31 +0100, "Al@n" <@l@n@gawsi.freeserve.co.uk>
> wrote:
>
>>Hi.
>>
>>I am endeavouring to reflect the caption name of a number of check boxes
>>as
>>bookmark entries from a document. (In the form.initialize event.)
>>i.e. ChkWPDW1 caption = bmWPDW1(bookmark).value, and do the same for up to
>>7
>>check boxes within a frame/
>>
>>I have got as far as the code below, however I get the following message
>>"The requested member of the collection does not exist."
>>
>>Please can you tell me if this method is possible and, if so what is
>>causing
>>the issue from the code below.
>>
>>Thank you for your consideration.
>>
>>Al@n
>>
>>Dim Name$, MyString
>>For Each ctl In fraWorksWPD.Controls
>> If Left(ctl.Name, 3) = "chk" Then
>> MyString = ctl.Name
>> Name$ = Mid(MyString, 4)
>> ctl.Caption= ActiveDocument.Bookmarks("bm &
>>Name$").Range.Text
>> End If
>>Next ctl
>>End With
>
> You need to keep in mind the distinction between string variables and
> literals,
> and the way double quotes are used to indicate literals.
>
> The bookmark name you're trying to use in the current code is the literal
> string
>
> "bm & Name$"
>
> where the characters " & Name$" are part of the literal. What you want
> instead
> is
>
> "bm" & Name$
>
> --
> Regards,
> Jay Freedman
> Microsoft Word MVP FAQ: http://word.mvps.org > Email cannot be acknowledged; please post all follow-ups to the newsgroup
> so all may benefit.
All times are: Eastern Time (US & Canada) (change)
Page 1 of 1
You can post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum