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 / Mailmerge and Fax / November 2003

Tip: Looking for answers? Try searching our database.

problem with word freezing after updating fields

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Feng - 18 Nov 2003 22:11 GMT
I have a piece of code which works perfectly fine in Word 2002.  However in Word 97, it has this problem.  Most of the code just adds the nested picture field that I asked help for yesterday.  In the last line, the Activedocument tries to update its fields, but Word freezes everytime the update is attempted
my code is
WordDoc = Application.ActiveDocumen
WordFields = WordDoc.Field
WordMergeFields = WordDoc.MailMerge.Field
WordSelection = Application.Selectio

       Dim DirName As String = DirPath_txtbox.Tex
       Dim extName As String = ext_txtbox.Tex
       Dim msg As Strin
       Dim path2 As Strin
     
       If DirName.Chars(Len(DirName) - 1) = "\" The
           DirName = DirName.Substring(0, Len(DirName) - 1
       End I
       DirName = DirName + "\
       path2 = AddSlash(PicPath_txtbox.Text
       DirName = AddSlash(DirName

       leftSpace = DirName.Length(
       leftSpace = -leftSpac
 
       If (response = MsgBoxResult.Yes) The
           WordDoc.ActiveWindow.View.ShowFieldCodes = Tru

           WordSelection.TypeText(DirName
           WordMergeField = WordMergeFields.Add(WordSelection.Range, type
           WordSelection.TypeText("." & extName
           WordMergeField.Select(
           WordSelection.MoveStart(Word.WdUnits.wdCharacter, leftSpace
           WordSelection.MoveEnd(Word.WdUnits.wdCharacter, 1 + extName.Length()
           WordRange = WordSelection.Range(
           oAutoText = WordObject.NormalTemplate.AutoTextEntries.Add(Name:="MyPicture", Range:=WordRange
           WordRange.Delete(
           fld = WordFields.Add(WordSelection.Range, Word.WdFieldType.wdFieldEmpty, "INCLUDEPICTURE """" \d", False
           WordSelection.MoveRight(Word.WdUnits.wdCharacter, 18

           WordMergeFields.AddIf(Range:=WordSelection.Range(), MergeField:=type, Comparison:=Word.WdMailMergeComparison.wdMergeIfIsNotBlank, TrueAutoText:="MyPicture", FalseText:=path2
           oAutoText.Delete(
           WordDoc.ActiveWindow.View.ShowFieldCodes = Fals
           WordDoc.Fields.UpdateSource(
       End If
Cindy M  -WordMVP- - 26 Nov 2003 17:14 GMT
Hi =?Utf-8?B?RmVuZw==?=,

This code, as it stands, does not "run" IN any version of Word, it's not valid
VBA. What programming environement / language are we dealing with, here? Sorta
looks like .NET...

But as far as I know, NET framework / PIAs don't work with Office 97?

> I have a piece of code which works perfectly fine in Word 2002.  However in Word 97, it has this problem.  Most of the code just adds the nested picture
field that I asked help for yesterday.  In the last line, the Activedocument
tries to update its fields, but Word freezes everytime the update is
attempted.
> my code is:
> WordDoc = Application.ActiveDocument
> WordFields = WordDoc.Fields
> WordMergeFields = WordDoc.MailMerge.Fields
> WordSelection = Application.Selection

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Sep 30 2003)
http://www.mvps.org/word

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :-)
 
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.