WUGNET, the Windows User Group Network
Your Complete Resource Center for "The Best" in Shareware, Computing Tips and Support, Windows Industry News... and much more!
Home Forums Shareware Windows Tips Hot Offers FREE Newsletters Arcade Contact Us About Partners
Search WUGNET: RSS Feeds RSS Feeds Advertise with WUGNET    |    Shareware eBooks
HomeHome FAQFAQ   SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log in/Register/PasswordLog in/Register/Password

Issue assigning checkbox caption

 
   Home -> Office -> User Forms RSS
Next:  User Forms: SOLVED: Problem calling userform at Document New  
Author Message
user

External


Since: Nov 19, 2006
Posts: 9



(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

--
Al@n
Back to top
Login to vote
Jay Freedman

External


Since: Mar 17, 2004
Posts: 4583



(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.
Back to top
Login to vote
user

External


Since: Nov 19, 2006
Posts: 9



(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.
Back to top
Login to vote
Display posts from previous:   
       Home -> Office -> User Forms 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
Categories:
 Windows XP
 Windows Vista
 Windows Other
  Office
 Office Other
 Security
 WinRAR
  • Home |
  • Shareware |
  • Windows Tips |
  • Hot Offers |
  • FREE Newsletters |
  • Arcade |
  • Forums |
  • eBooks |
  • About WUGNET |
  • Partners |
  • Contact

  • WUGNET Privacy Policy |
  • Link to WUGNET