[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.vb.general.discussion

Getting text from hidden text producing error

Davo

7/18/2010 9:01:00 PM

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
---



3 Answers

ralph

7/18/2010 9:30:00 PM

0

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

Davo

7/18/2010 9:43:00 PM

0

Thanks, I did try posting to a Word VBA newsgroup, but recieved a 'not valid' pop up.


Kevin Provance

7/18/2010 9:59:00 PM

0

"johnnykunst" <user@msgroups.net/> wrote in message
news:OS7r9IsJLHA.4476@TK2MSFTNGP05.phx.gbl...
: Thanks, I did try posting to a Word VBA newsgroup, but recieved a 'not
valid' pop up.

Dont use MS's news servers. See my sig. Eternal September carries all MSFT
newsgroups.

--
Customer Hatred Knows No Bounds at MSFT
Free usenet access at http://www.eternal-sep...
ClassicVB Users Regroup! comp.lang.basic.visual.misc