ralph
7/18/2010 9:30:00 PM
On Sun, 18 Jul 2010 14:01:13 -0700, johnnykunst <user@msgroups.net/>
wrote:
>I am using code to populate a drop down from hidden text (in text formfields) in a Word form. The code works great, however, I have now hidden the section that contains the text form fields and the code returns an error. Is there something I should be inserting in the code so that it can cope with hidden text/ bookmarks? I don't want to unprotect, unhide, run existing code, and then rehide and reprotect as this is cumbersome.
>
>ub Fillnamelist()
>
> Select Case ActiveDocument.FormFields("scheme").Result
> Case "CAMBERWELL"
> With ActiveDocument.FormFields("nameDD").DropDown.ListEntries
> .Clear
> .Add ("ENTER NAME")
> .Add ActiveDocument.Bookmarks("c1").Range.Text
> .Add ActiveDocument.Bookmarks("c2").Range.Text
> .Add ActiveDocument.Bookmarks("c3").Range.Text
> .Add ActiveDocument.Bookmarks("c4").Range.Text
> .Add ActiveDocument.Bookmarks("c5").Range.Text
> .Add ActiveDocument.Bookmarks("c6").Range.Text
> .Add ActiveDocument.Bookmarks("c7").Range.Text
> .Add ActiveDocument.Bookmarks("c8").Range.Text
> .Add ActiveDocument.Bookmarks("c9").Range.Text
> .Add ActiveDocument.Bookmarks("c10").Range.Text
> .Add ActiveDocument.Bookmarks("c11").Range.Text
> .Add ActiveDocument.Bookmarks("c12").Range.Text
> .Add ActiveDocument.Bookmarks("c13").Range.Text
> .Add ActiveDocument.Bookmarks("c14").Range.Text
> .Add ActiveDocument.Bookmarks("c15").Range.Text
> .Add ActiveDocument.Bookmarks("c16").Range.Text
>---
>
>
You don't have to do that much work, but I do believe you need to
toggle the .Hidden and .ShowHidden attributes for Ranges and
Bookmarks.
But you will be better served if you post to a Word newsgroup or
forum. You are using VBA, but are working with Word objects.
Also when you re-post let them know the version of Word you are using.
-ralph