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
Solved

Clean up Word formatting in Access form

Posted on 2013-05-23
6
273 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
  • 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
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 
LVL 29

Accepted Solution

by:
IrogSinta earned 500 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

Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

828 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