Private Sub cmdCreateHTMLPages_Click() Dim company, companyStr, category, categoryStr, url, urlStr Dim imageURL, imageURLStr, completeStr Dim txtFileName, myPath Dim rowCounter As Integer myPath = "C:\Users\rosener\Desktop\a-temp" ChDrive myPath ChDir myPath txtFileName = "all-companies.html" Open txtFileName For Output As #1 txtFileName = "service-companies.html" Open txtFileName For Output As #2 txtFileName = "retail-companies.html" Open txtFileName For Output As #3 rowCounter = 2 While Not IsEmpty(Cells(rowCounter, 1)) company = Cells(rowCounter, 1) companyStr = "" & company & " " category = Cells(rowCounter, 2) categoryStr = "(" & category & ") " url = Cells(rowCounter, 3) urlStr = "" & url & "" & "
"
imageURL = Cells(rowCounter, 4)
imageURLStr = "" & "
" completeStr = companyStr & categoryStr & urlStr & imageURLStr ' This replaces every instance of the tilde with a double quote. completeStr = Replace(completeStr, Chr(126), Chr(34)) Print #1, completeStr If category = "Service" Then Print #2, completeStr End If If category = "Retail" Then Print #3, completeStr End If rowCounter = rowCounter + 1 Wend Close #1 Close #2 Close #3 MsgBox ("Information written.") End Sub