?
Solved

Clean up Word formatting in Access form

Posted on 2013-05-23
6
Medium Priority
?
277 Views
Last Modified: 2013-05-24
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
0
Comment
Question by:correlate
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 29

Expert Comment

by:IrogSinta
ID: 39190447
Try using the PlainText() function to remove the HTML tags.
=PlainText(NameOfFieldWithHTMLstring)
0
 

Author Comment

by:correlate
ID: 39190460
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
0
 

Author Comment

by:correlate
ID: 39190584
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?
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 29

Accepted Solution

by:
IrogSinta earned 2000 total points
ID: 39192901
So it would be something like this:

Dim strTemp as String

strTemp = [YourTextFromWord]
strTemp = Replace (strTemp, "<Strong>", "#Strong#") 
strTemp = Replace (strTemp, "</Strong>", "#/Strong#")

strTemp = =PlainText(strTemp)
strTemp = Replace (strTemp, ,"#Strong#", "<Strong>") 
strTemp = Replace (strTemp, "#/Strong#", "</Strong>")

Open in new window

0
 

Author Closing Comment

by:correlate
ID: 39194990
Perfect - thank you very much - works a treat
0
 
LVL 29

Expert Comment

by:IrogSinta
ID: 39195901
You're quite welcome.
0

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question