Link to home
Start Free TrialLog in
Avatar of Tom Crowfoot
Tom CrowfootFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Clean up Word formatting in Access form

Dear Experts

I am building a newsletter database where the user will copy paste stories into a form from word.  The field where the text is pasted is set to rich text field.  

I am keen to remove all html formatting (e.g. font color, size hyperlinks, underlines) from the field with the exception of a couple of mark ups (namely <Strong> </strong> & paragraph marks) ...

Is there a way to do this?

Many thanks
Avatar of IrogSinta
IrogSinta
Flag of United States of America image

Try using the PlainText() function to remove the HTML tags.
=PlainText(NameOfFieldWithHTMLstring)
Avatar of Tom Crowfoot

ASKER

Hi IrogSinta,

Thanks for that, it covers everything I want it to do except it removes the bold from text & I'm keen to keep that in there
So had a few further thoughts on how to crack this ...

I have made a calculated field (called "Formatted") which takes the text from the field I am trying to manipulate ([Body]) and displays it with all the tags. All I need to do now is copy the text from formatted into a string, manipulate it and then place it into a new field.

To make the manipulation easier I was thinking of deploying the following logic, but had no real idea how to code this.

1. Find & Replace <Strong> to #Strong# & </strong> to #/strong# (i.e. the tags I want to keep)

2. Trim everything that appears between "<" & ">"

3. Then do another find & replace #Strong# to <Strong> & #/strong# to </strong> (to reinstate those tags)

4. Paste the result into the new field

No sure if this helps?
ASKER CERTIFIED SOLUTION
Avatar of IrogSinta
IrogSinta
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Perfect - thank you very much - works a treat
You're quite welcome.