Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <blockquote> <p>I have thousands of html files... </p> </blockquote> <p>Do you actually have these files on-hand, or are they online? </p> <blockquote> <p>...and need to save each of them as txt...</p> </blockquote> <p>Any text editor should be able to save the data within (i.e. why use FireFox), and I think a straight rename of .htm or .html to .txt. will work (at least on any Windows system). Or do you mean: save just the <em>displayed</em> text of the HTML file?</p> <hr> <p><strong>EDIT:</strong> </p> <p>First, start off with <a href="http://vba-corner.livejournal.com/4623.html" rel="nofollow">this link</a>, which has a good explanation of how to get started with <strong>shdocvw</strong>, which you will need to do this. Once you have the reference set up, using the functions</p> <pre><code>Function GetNewIE() As SHDocVw.InternetExplorer </code></pre> <p>and </p> <pre><code>Function LoadWebPage(i_IE As SHDocVw.InternetExplorer, i_URL As String) As Boolean </code></pre> <p>from the link (just copy into your project as described in the link) to load your individual html files, using a loop to get through each file. (Excel would be good for this, because you can put your list of files into the cells, and cycle through each cell to retrieve.) I have never done something like this with so many files, so I cannot guarantee this will work, unfortunately...</p> <pre><code>Dim IE As SHDocVw.InternetExplorer Dim lRow as Long 'Long in case you have a LOT of files Dim iFNum As Integer Dim sFilePath As String Set IE = GetNewIE For lRow = 1 To 5000 Step 1 ' Assuming you have 5,000 html files, so 5,000 rows with the paths to each sFilePath = ActiveSheet.Range("A" &amp; lRow).Value ' This should also include the filepath. i.e. "C:\dir\..." If LoadWebPage(IE, sFilePath) Then iFNum = FreeFile(lRow) Open sFilePath &amp; ".txt" For Output As iFNum Write #iFNum, IE.Document.InnerText Close #iFNum End If Next lRow </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload