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 / August 2004

Tip: Looking for answers? Try searching our database.

Check for changed text

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
John J - 10 Aug 2004 13:10 GMT
Hello all,

I take various parts of a datasource and put them all
together on mail merge to make a unique reference.  When
the reference is displayed in the merged document, it has
become text.

It may be that the user needs to update this reference in
some way.  Is there any way of checking that the
reference has been updated and storing away the updated
version?

I have thought of scanning capturing the reference when
the document is presented to the user and then on close
of the document scanning it again for the original
version of the reference and if not found using bookmarks
around the reference field to copy away the new edited
version, but this will involve some heavy duty macros
organising and testing.  I am hoping there may be some
obvious easier way or Word facility ...

If you can give me any ideas for another approach then
that would be great.

Thank you

John J
John J. - 11 Aug 2004 10:51 GMT
Hello all again,

With time, you can do anything.  If you want the solution
to this, this is what I found:

This macro would run, from an point before the document
is for example printed.  Or could be behind a toolbar
button.

Identify where the reference field starts and pass in the
details.  I am assuming the refernce field is on its own
line.  If not you would need the MoveEndUntil function

...
strOurRef = TrapTheReference("Our ref:")

If strOurRef = "" Then
  strOurRef = TrapTheReference("Our reference:")
End If

.

Function TrapTheReference(strSearchText As String) As
String
   
 Dim strSelectedText As String
 With Selection
     .Find.ClearFormatting
         With .Find
             .Text = strSearchText
             .Replacement.Text = ""
             .Forward = True
             .Wrap = wdFindContinue
             .Format = False
         End With
     .Find.Execute
     .MoveRight Unit:=wdCharacter, Count:=2
     .EndKey Unit:=wdLine, Extend:=wdExtend
     .MoveLeft Unit:=wdCharacter, Count:=1,
Extend:=wdExtend
 End With
 strSelectedText = Selection.Text
 Selection.MoveRight Unit:=wdCharacter, Count:=1
 TrapTheReference = strSelectedText
End Function

It seems to do the trick.  Hope you find it useful and
something to build on.  Don't forget any error handling
you may need.

Cheers

John J.

>-----Original Message-----
>Hello all,
[quoted text clipped - 25 lines]
>John J
>.

Rate this thread:






 
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.