Prev: Pasting text to browser
Next: DLL Heck
From: johnnykunst on 18 Jul 2010 17:01 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 ---
From: ralph on 18 Jul 2010 17:30 On Sun, 18 Jul 2010 14:01:13 -0700, johnnykunst <user(a)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
From: johnnykunst on 18 Jul 2010 17:43 Thanks, I did try posting to a Word VBA newsgroup, but recieved a 'not valid' pop up.
From: Kevin Provance on 18 Jul 2010 17:59 "johnnykunst" <user(a)msgroups.net/> wrote in message news:OS7r9IsJLHA.4476(a)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-september.org ClassicVB Users Regroup! comp.lang.basic.visual.misc
|
Pages: 1 Prev: Pasting text to browser Next: DLL Heck |