![]() |
#1
|
|||
|
|||
![]()
Hello
I'm looking for a macro that will extract data from an HTML file, Here is the code that did the job, but in the HTML file the search code is changed and now the macro doesn't work. The macro worked pretty fast, if any one can fix this i would really appreciate it, attached is the input file with raw data and the output file that shows what it should look like. Thanks. Code:
Application.ScreenUpdating = False Dim StrOut As String, wdDoc As Document With ActiveDocument.Range With .Find .ClearFormatting .Replacement.ClearFormatting .Text = "^34\>[!\<]@\</a\>^13[ ]@\</h3\>*address^34\>[!\<]@\</div\>*phone^34\>[!\<]@\</div\>" .Replacement.Text = "" .Forward = True .Wrap = wdFindStop .Format = False .MatchWildcards = True .Execute End With Do While .Find.Found StrOut = StrOut & Trim(Split(Split(.Text, "</a>")(0), vbCr)(1)) & vbTab StrOut = StrOut & Split(Split(Split(.Text, "</a>")(1), "</div>")(0), ">")(2) & vbTab If InStr(.Text, "<span>") = 0 Then StrOut = StrOut & Split(Split(Split(.Text, "</a>")(1), "</div>")(1), ">")(1) End If StrOut = StrOut & vbCr .MoveStart wdCharacter, InStr(.Text, Split(Split(Split(.Text, "</a>")(1), "</div>")(0), ">")(2)) .Collapse wdCollapseStart .Find.Execute Loop End With Set wdDoc = Documents.Add wdDoc.Range.Text = StrOut Application.ScreenUpdating = True Dim I As Integer For I = 1 To 100 ' Loop 100 times. Beep ' Sound a tone. Next I Last edited by macropod; 06-28-2019 at 06:09 PM. Reason: Added code tags |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Extract data from HTML File. | donlincolnmsof | Word VBA | 0 | 03-07-2019 12:17 PM |
Need help to extract specific data from text file using vba | victor92 | Excel Programming | 0 | 12-01-2017 12:53 AM |
![]() |
PRA007 | Word VBA | 13 | 11-01-2015 11:20 PM |
Macro to highlight repeated words in word file and extract into excel file | aabri | Word VBA | 1 | 06-14-2015 07:20 AM |
![]() |
iliauk | Word | 3 | 11-08-2013 04:37 PM |