Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / November 2004

Tip: Looking for answers? Try searching our database.

I'm losing formtext. Why, please?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
David - 01 Nov 2004 23:13 GMT
I have a template that uses a userform to collect data, and formfields for
easy completion. After completion, I want to unlink the fields to convert the
whole doc into regular text. The formtext text boxes lose their data, but the
formdropdowns don't. I'm not turning formfield protection on or off. Is
something triggering a reset?

Private Sub cmdFinish_Click()
   
Call FillVars     '(resets vars to form.control.values)
Call FillCustomDocProperties     '(sets customDocProperties to vars)
Call UpdateFields     '(fields.update, w/headers/footers, like 'unlink' code
below)

   With ActiveDocument
   .Save
       .Fields.Unlink
           If .Sections.Count >= 1 Then
               For I = 1 To .Sections.Count
                   
.Sections(I).Headers(wdHeaderFooterPrimary).Range.Fields.Unlink
                   
.Sections(I).Headers(wdHeaderFooterFirstPage).Range.Fields.Unlink
                   
.Sections(I).Footers(wdHeaderFooterPrimary).Range.Fields.Unlink
                   
.Sections(I).Footers(wdHeaderFooterFirstPage).Range.Fields.Unlink
               Next I
           End If
       .Save
   End With

Thank you.
Jezebel - 01 Nov 2004 23:55 GMT
Are you updating the fields before unlinking them? Anyway, here is better
code for updating and unlinking all fields in a document, wherever they may
be located --

Dim pRange as Word.Range
For each pRange in ActiveDocument.StoryRanges
   Do
       With pRange.Fields
           .Update
           .Unlink
       End with
       set pRange = pRange.NextStoryRange
   Loop until pRange is nothing
Next

> I have a template that uses a userform to collect data, and formfields for
> easy completion. After completion, I want to unlink the fields to convert the
[quoted text clipped - 28 lines]
>
> Thank you.
David - 02 Nov 2004 22:59 GMT
Thank you, it does seem a lot better.
I am updating the fields before unlinking them.

I still don't know what is causing me to lose my text.

Thank you
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.