Private Sub cmdCreateHTMLPages_Click() Dim company, companyStr, catagory, catagoryStr, 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 & " " catagory = Cells(rowCounter, 2) catagoryStr = "(" & catagory & ") " url = Cells(rowCounter, 3) urlStr = "" & url & "" & "

" imageURL = Cells(rowCounter, 4) imageURLStr = "" & "

" completeStr = companyStr & catagoryStr & urlStr & imageURLStr ' This replaces every instance of the tilde with a double quote. completeStr = Replace(completeStr, Chr(126), Chr(34)) Print #1, completeStr If catagory = "Service" Then Print #2, completeStr End If If catagory = "Retail" Then Print #3, completeStr End If rowCounter = rowCounter + 1 Wend Close #1 Close #2 Close #3 MsgBox ("Information written.") End Sub