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

Tip: Looking for answers? Try searching our database.

Finding where to insert special characters

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Francis Hookham - 28 Aug 2006 17:20 GMT
(Referring to the text below the line)

Until recently a list of meetings was sent out as a printable .rtf file. Now
we have a Meetings page on our website but I still have to send out a
printable document or hard copy to a few members who do not have a net
connection.

Having copied the Meeting page and pasted into Word as plain text I need to
compress each event into a single paragraph, with a Manual Line Break
separating everything after the meeting subject. Unfortunately it is beyond
me to do this other than manually because the line break needs to come
before Host or Contact or Cashier or Reception, whichever is first.
Sometimes there is only a Contact, sometimes there is a Host and sometimes
there is neither so the Cashier comes first.

With earlier MVP help I now have a macro which recognises the date and time
and places a tab between date and time and between time and venue. I doubt
we shall ever be able to automatically put a tab between venue, meal and
speaker.

However it should be possible to put a manual line break ahead of whichever
comes first of Host, Contact, Cashier or Reception.

Then, I wonder if there is a way of replaceng the paragraph marks with a ",
" between each remaining item.

Taking the first event:

29.08.2006          13:00          University Arms Hotel Lunch (frugal) Mark
Oliver, The work of Cambridgeshire Trading Standards Department

 Host: Ben Jupp

Cashier: Graeme Minto

Reception: Stan Webster and Ian Purdy

Would end up as:

29.08.2006          13:00          University Arms Hotel Lunch (frugal) Mark
Oliver, The work of Cambridgeshire Trading Standards Department
Host: Ben Jupp, Cashier: Graeme Minto, Reception: Stan Webster and Ian Purdy

Many thanks and apologies for this long winded posting - I suppose the
problem is that I am able to write a series of IF statements in this
situation. Maybe I shall have to try in XL

Francis Hookham

29.08.2006          13:00          University Arms Hotel Lunch (frugal) Mark
Oliver, The work of Cambridgeshire Trading Standards Department

 Host: Ben Jupp

Cashier: Graeme Minto

Reception: Stan Webster and Ian Purdy

03.09.2006             Grafham Water RYLA Week RYLA - the Rotary Youth
Leadership Award at Graffham Water, 2-9 September, all welcome on Sunday,
3rd, to see what it is all about

 Contact: Victor Bugg

05.09.2006          12:00          University Arm Hotel ISC meeting
International Service Committee meeting at the UAH in room to be advised

05.09.2006          13:00          University Arms Hotel Lunch meeting
Murray Morse, Editor Cambridge Evening News, Developments of the CEN

 Host: Charles Hewitson

Cashier: John Grieve

Reception: Tony Newall

05.09.2006          18:15          CUP Council meeting Council Meeting at
CUP, Shaftesbury Rd. All members are welcome

10.09.2006             TBA Sunday Walk Put this date in your diary for the
Sunday Walk No. 4 to be arranged by Bernard - details later

 Contact: Bernard Townshend

12.09.2006          07:45          University Arms Hotel Breakfast
Fellowship meeting

 Cashier: Charles Hewitson

Reception: Jim Lamb
Graham Mayor - 29 Aug 2006 14:52 GMT
It may be easier to simply use a selection of replace functions. Something
along the lines of the following shouldn't be far off the mark.

   Selection.Find.ClearFormatting
   Selection.Find.Replacement.ClearFormatting
   With Selection.Find
       .Text = "([0-9]{2}.[0-9]{2}.[0-9]{4})"
       .Replacement.Text = "#@#@#@\1"
       .Forward = True
       .Wrap = wdFindContinue
       .Format = False
       .MatchCase = False
       .MatchWholeWord = False
       .MatchAllWordForms = False
       .MatchSoundsLike = False
       .MatchWildcards = True
   End With
   Selection.Find.Execute replace:=wdReplaceAll
   With Selection.Find
       .Text = "(^13)@"
       .Replacement.Text = "\1"
   End With
   Selection.Find.Execute replace:=wdReplaceAll
   With Selection.Find
       .Text = "^13"
       .Replacement.Text = ", "
   End With
   Selection.Find.Execute replace:=wdReplaceAll
   With Selection.Find
       .Text = "#@#@#@"
       .Replacement.Text = "^p"
       .MatchWildcards = False
   End With
   Selection.Find.Execute replace:=wdReplaceAll
   With Selection.Find
       .Text = "[, ]{1,}(^13)"
       .Replacement.Text = ".\1"
       .MatchWildcards = True
   End With
   Selection.Find.Execute replace:=wdReplaceAll
   Selection.WholeStory
   With Selection.ParagraphFormat
       .LeftIndent = CentimetersToPoints(0)
       .RightIndent = CentimetersToPoints(0)
       .SpaceBefore = 0
       .SpaceBeforeAuto = False
       .SpaceAfter = 12
   End With
   Selection.EndKey Unit:=wdStory

Signature

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor -  Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

> (Referring to the text below the line)
>
[quoted text clipped - 89 lines]
>
> Reception: Jim Lamb
Francis Hookham - 01 Sep 2006 17:11 GMT
Many thanks Graham - I am making progress.

How can I find the second Tab Character ^t in a paragraph and replace it
with a Manual Line Break ^l through out the text?

I might want to replace the third Tab Character, rather than the second -
will it be obvious from your code how to find a particular tab character
(2nd, 3rd, 4th) within the paragraph? This would answer a problem in another
regular need to convers tab separated text.

Many thanks

Francis

> It may be easier to simply use a selection of replace functions. Something
> along the lines of the following shouldn't be far off the mark.
[quoted text clipped - 139 lines]
>>
>> Reception: Jim Lamb
Russ - 09 Sep 2006 09:15 GMT
Francis,
Code below is one way of doing what you ask.

> Many thanks Graham - I am making progress.
>
> How can I find the second Tab Character ^t in a paragraph and replace it
> with a Manual Line Break ^l through out the text?

Alter by changing what's in first set of parentheses in .Text string
i.e. to have it replace 3rd tab use "(*^t*^t*)(^t)"

Sub Macro9()
Dim aP As Paragraph
For Each aP In ActiveDocument.Paragraphs
   With aP.Range.Find
       .Text = "(*^t*)(^t)"
       .Replacement.Text = "\1^l"
       .MatchWildcards = True
       .Execute Replace:=wdReplaceOne
   End With
Next aP
End Sub

> I might want to replace the third Tab Character, rather than the second -
> will it be obvious from your code how to find a particular tab character
[quoted text clipped - 148 lines]
>>>
>>> Reception: Jim Lamb

Signature

Russ

drsmN0SPAMikleAThotmailD0Tcom.INVALID

 
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.