Results 1 to 6 of 6
  1. #1
    New Lounger
    Join Date
    Mar 2004
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Excel 2002 (Excel: vba code to strip html)

    Hi VBA/ excel gurus,

    I have an excel spreadsheet that gets data from a database. All is good so far. However there is a requirement to also import a field that is currently formatted in html. I would like the end user to see this as plain text. (or at least readable text. Without the tags) Are there any freeware vba html strippers that people are aware of? Is this the correct approach to take? (I also considered a regex...)

    I would love some example code... As I am not an VBA expert.

    cheers,





    david.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Excel 2002 (Excel: vba code to strip html)

    A Google search for strip html tags results in lots of hits, such as Stripping HTML Tags using Regular Expressions and Strip HTML tags from a Web Page and save the Output to a Text File (the first two hits when I searched).

  3. #3
    New Lounger
    Join Date
    Mar 2004
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Excel 2002 (Excel: vba code to strip html)

    Thanks Hans,

    Sorry I should have said that I have googled this (about 2 hours and counting so far)

    The first link is currently where I think I will have to go for a solution... However my boss visably flinched when I told him I thought we might need to use a regex.

    The second link you sent, I have already downloaded and tried and couldn't get it to work. Well it works, but is a bit too keen. Every html string I send gets returned as blank. I couldnt find any feedback/ help on the code to take it further.

    cheers,





    david. - about to start writing a regex :-)

  4. #4
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Excel 2002 (Excel: vba code to strip html)

    David

    If it is not too secret is there anyway you could upload a sample set of the spreadsheet, or at least a cut down version of it with some dummy code. I will see if I can play with it for you
    Jerry

  5. #5
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Excel 2002 (Excel: vba code to strip html)

    Good on ya buddy <img src=/S/cool.gif border=0 alt=cool width=15 height=15>
    Jerry

  6. #6
    New Lounger
    Join Date
    Mar 2004
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Excel 2002 (Excel: vba code to strip html)

    Edited by <!profile=StuartR>StuartR<!/profile> to add <!t><!/t> and <!t><!/t> tags to make link active, see <!help=19>Help 19<!/help>

    Hi all,

    The regex solution is the way forward. <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

    After Hans post, I went back to the regex, and implemented it. It works fine.

    Thanks for everyone's time. with special thanks to Hans and Jerry for the time they took replying to me; respect to the guys from rolla, http://www.4guysfromrolla.com/webtech/042501-1.shtml

    cheers,




    david.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •