Sub SaveAsUTF8HTMLall()
Dim Cell As Range, filename As String, Rng As Range
Dim p As String
On Error Resume Next
p = DesktopFolder & "\KingOfCamden\"
MkDir p
'filename = ThisWorkbook.Path & "\Export" & Replace(Sheets("Settings").Range("C31").Value, " ", "_") & ".html" 'cell C31 contains the file name of the consolidated HTML
filename = p & "Export" & Replace(Sheets("Settings").Range("C31").Value, " ", "_") & ".html" 'cell C31 contains the file name of the consolidated HTML
Application.ScreenUpdating = False
' ADODB.Stream file I/O constants
Const adCrLf As Long = -1
Const adSaveCreateNotExist As Long = 1
Const adSaveCreateOverWrite As Long = 2
Const adTypeText As Long = 2
Set Rng = Worksheets("Settings").Range("C33:C129") 'this is the range that holds the HTML content to consolidate
With CreateObject("ADODB.Stream")
.Open
.Type = adTypeText
.Position = 0
.Charset = "utf-8"
.LineSeparator = adCrLf
For Each Cell In Rng
.WriteText Cell.Text
Next Cell
.SaveToFile filename, adSaveCreateOverWrite
.SetEOS
.Close
End With
Application.ScreenUpdating = True
End Sub
Function DesktopFolder()
Dim wshShell As Object, s As String
Set wshShell = CreateObject("WScript.Shell")
s = wshShell.SpecialFolders("Desktop")
Set wshShell = Nothing
DesktopFolder = s
End Function
Bookmarks