Web formated calendar to unformated Word text

F

Francis Hookham

Ops! Perhaps I should have posted this here instead of on
'microsoft.public.word.programming'
(Not sure what the diff is)

Reqd: a Word version of part of a calendar on a club website for those
without web access

The following pastes the copied section of the four column calendar

Sub PasteUnformatedText()
Selection.PasteAndFormat (wdFormatPlainText)
End Sub

but I now need to do something to make dates stand out

A hanging indent is no good unless there were some way of identifying and
changing the paragraph marks which do not precede the dates and changing
them to manual line breaks

Is there some way of identifying the dates and adding a second paragraph
mark before them?

A separate issue is to add a semi-colon between cells (the four columns are
'Date', 'Venue', 'Event/Name' and 'Info'. Without some break the line runs
into one and does not read well

If the date/time could be identified it could be emboldened - it is always
dd.mm.yyyy hh:mm

Here are a few lines of the unformatted text - any help you gan give will be
much appreciated

Francis Hookham



Date Venue Event/Name Info

25.06.2006 10:15 Castle Camps Sunday Walk Sunday Walking Group - 4.5 mile
walk from/to The Cock, Castle Camps, nr Haverhill

Contact: Bernard Townshend

27.06.2006 13:00 University Arms Hotel Lunch meeting Lunch and The Cambridge
Club's Presidential Handover followed by Stephen Kay, managing director
Cambridge Water Company speaking about 'Developments at CWC'

Host: Charles Hewitson

Cashier: Robert Raywood

Reception 1: Robert Ransom

Reception 2: David Ridgeon

01.07.2006 Coventry RIBI handover RIBI Presidential handover in Coventry

02.07.2006 Cambridge District handover District 1080 Handover hosted by the
Rotary Club of Cambridge at Wolfson College - Nigel Neville is due to become
the District Governor

Contact: FEC

04.07.2006 13:00 University Arms Hotel Lunch meeting

Host: Paul Auton

Cashier: Victor Bugg

Reception 1: Francis Hookham

Reception 2: Roger Asbury

04.07.2006 18:00 CUP Council meeting Council Meeting at CUP, Shaftesbury Rd
 
D

Doug Robbins - Word MVP

If the example that you posted is typical, the following will probably do
what you want:

Selection.HomeKey wdStory
Selection.Find.ClearFormatting
With Selection.Find
Do While .Execute(FindText:="^l([0-9]{2}.[0-9]{2}.[0-9]{4})",
ReplaceWith:="^p\1", _
MatchWildcards:=True, Wrap:=wdFindContinue, Forward:=True) = True
Loop
End With
Selection.HomeKey wdStory
Selection.Find.ClearFormatting
With Selection.Find
Do While .Execute(FindText:="^l", ReplaceWith:=" ", _
MatchWildcards:=False, Wrap:=wdFindContinue, Forward:=True) = True
Loop
End With
Selection.HomeKey wdStory
Selection.Find.ClearFormatting
With Selection.Find
Do While .Execute(FindText:="([0-9]{2}:[0-9]{2}) ([A-Z]{1})",
ReplaceWith:="\1^t\2", _
MatchWildcards:=True, Wrap:=wdFindContinue, Forward:=True) = True
Loop
End With
Selection.HomeKey wdStory
Selection.Find.ClearFormatting
With Selection.Find
Do While .Execute(FindText:="(.[0-9]{4}) ", ReplaceWith:="\1^t", _
MatchWildcards:=True, Wrap:=wdFindContinue, Forward:=True) = True
Loop
End With
Selection.HomeKey wdStory
Selection.Find.ClearFormatting
With Selection.Find
Do While .Execute(FindText:="(.[0-9]{4})^t([A-Z]{1})",
ReplaceWith:="\1^t^t\2", _
MatchWildcards:=True, Wrap:=wdFindContinue, Forward:=True) = True
Loop
End With
ActiveDocument.Range.ConvertToTable Separator:=vbTab, NumColumns:=3

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top