Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8688783
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T23:27:57+00:00 2026-06-12T23:27:57+00:00

I trying to remove the html tags using the code below but it does

  • 0

I trying to remove the html tags using the code below but it does not do anything. I have tried running it again but to no use. Could someone please advise what could be the issue. Attaching a snapshot of the file with html tags. For info, the data comes from the MS Access and the MS Access links to Sharepoint lists.

enter image description here

Sub Import_AccessData()
 Dim strtKeyMsgRange As Range
 Dim KeyMsgRange As Range
 Dim KeyMsgRangeCell As Range
 Dim endKeyMsgRangeCell As Range

Set strtKeyMsgRange = Range("B2")
Set endKeyMsgRange = Range("AC13")

Set KeyMsgRange = Range(strtKeyMsgRange, endKeyMsgRange)

For Each KeyMsgRangeCell In KeyMsgRange
   a = StripHTML(KeyMsgRangeCell)
   KeyMsgRangeCell.Value = a
Next KeyMsgRangeCell

End Sub


Public Function StripHTML(cell As Range) As String
     Dim RegEx As Object
     Set RegEx = CreateObject("vbscript.regexp")

     Dim sInput As String
     Dim sOut As String


     sInput = cell.Value

     With RegEx
   .Global = True
   .IgnoreCase = True
   .MultiLine = True
   .Pattern = "<[^>]+>" 'Regular Expression for HTML Tags.
   .Pattern = "&nbsp;"
   .Pattern = "&amp;"
 End With

 sOut = RegEx.Replace(sInput, "")
 StripHTML = sOut
 Set RegEx = Nothing
End Function
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T23:27:58+00:00Added an answer on June 12, 2026 at 11:27 pm

    You are setting the Pattern property multiple times, it will only retain the last value assigned (&amp;).

    You need to use 3 regular expressions("<[^>]+>" => "", "&nbsp;" => " ", "&amp;" => "&"), or one expression that matches all of your inputs ("(&amp;)|(&nbsp;)|(<[^>]+>)" => "") to actually do this.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to solve a problem to remove HTML tags from a string.
I am trying to remove all the html tags out of a string in
I am trying to remove all HTML elements from a String. Unfortunately, I cannot
I'm trying to remove part of the path in a string. I have the
I'm trying to remove scrollbar from my facebook app. I tried js solution, that
Hello I was trying to remove objects from object array that I have and
I'm trying to create a function which removes html tags and attributes which are
I'm trying to write parsing script using python/scrapy. How can I remove [] and
Possible Duplicate: PHP Regular express to remove <h1> tags (and their content) I have
I'm trying to write a web application using Spring MVC. I have a configuration

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.