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 / October 2006

Tip: Looking for answers? Try searching our database.

Check for Links

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
takethemoney@gmail.com - 20 Oct 2006 15:55 GMT
Hello All, I am currently working on template for a document. The
authors of these documents are to be told to insert financial values in
the text by linking using Paste Special to an excel spreadsheet. In
order to check that they have done this and not simply typed in the
figure I would like a macro to scan through (searching for £ signs)
and check that the text to the right is a field (i.e. £{Link
EXCEL......}) instead of a number (£865,000). I am coming unstuck
becuase I don't know how to search for a field. Any suggestions will be
most gratefully received.

Richard

P.S. For 1,000,000 extra bonus points - In the same documents the
authors are being to told to keep a table of references to other
documents and use bookmarks  and cross-referencing to refer back to
this table when using the reference in the text (in case the titles
changes etc.). These authors are lazy, lazy people and it would be
great if I could do something like give them a button on the taskbar
which gives them a drop down list of the bookmarks currently created so
they can pick one and it'll drop in to the text. (Likewise Figures and
Tables). That would be such a boon.
Greg Maxey - 20 Oct 2006 17:32 GMT
Crude, but something like this might get you started.  It assumes that
there are no spaces between your currency symbol and the field code.

Sub ScratchMacro()
Dim oRng As Word.Range
Dim bCurView As Boolean
Set oRng = ActiveDocument.Range
bCurView = ActiveWindow.View.ShowFieldCodes
If bCurView = False Then ActiveDocument.Fields.ToggleShowCodes
With oRng.Find
 .Text = "$"
 While .Execute
   oRng.MoveEnd wdCharacter, 6
   If InStr(oRng.Text, "LINK") = 0 Then
     MsgBox "Foul"
     oRng.MoveEnd wdCharacter, -6
     oRng.HighlightColorIndex = wdBrightGreen
     If bCurView = False Then ActiveDocument.Fields.ToggleShowCodes
     Exit Sub
   End If
   oRng.Collapse wdCollapseEnd
 Wend
End With
If bCurView = False Then ActiveDocument.Fields.ToggleShowCodes
End Sub

What is one bonus point worth in English pounds?

> Hello All, I am currently working on template for a document. The
> authors of these documents are to be told to insert financial values in
[quoted text clipped - 17 lines]
> they can pick one and it'll drop in to the text. (Likewise Figures and
> Tables). That would be such a boon.
takethemoney@gmail.com - 23 Oct 2006 09:51 GMT
Hi Greg, thanks so much that works a treat. I modified it to look for
'£' and '£ ' so that got round the space after issue. I'm afraid
bonus points can only be traded for hugs at the moment. I'm working on
modifying a macro called MyBookMarkAddin which I found on the web.

Richard

> Crude, but something like this might get you started.  It assumes that
> there are no spaces between your currency symbol and the field code.
[quoted text clipped - 45 lines]
> > they can pick one and it'll drop in to the text. (Likewise Figures and
> > Tables). That would be such a boon.
 
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.