jaredaseltzer
New Member
- Joined
- May 5, 2015
- Messages
- 3
I am trying to download and save hundreds of webpages as html files using the code below. The code works great for pages that contain no unicode special characters, but not for what I need. An example url that I'm trying to programmatically download from within Excel is http://cal1.cn.huc.edu/get_a_chapter.php?file=51006&sub=1&cset=H
but all of the hebrew letters are turning into question marks when I download and save the html using this code:
How should I change this code so that it does not turn the special unicode characters into question marks?
but all of the hebrew letters are turning into question marks when I download and save the html using this code:
Code:
Sub Main()
Dim url as String, fn as String
url="http://cal1.cn.huc.edu/get_a_chapter.php?file=51006&sub=1&cset=H"
fn="C:\temp\Joshua-Chapter1.htm"
CreateFile fn, GetHTML(url)
End Sub
Function GetHTML(URL As String) As String
Dim objHttp As Object
Set objHttp = CreateObject("MSXML2.XMLHTTP")
Call objHttp.Open("GET", URL, False)
Call objHttp.Send("")
GetHTML = objHttp.ResponseText
End Function
Sub CreateFile(FileName As String, Contents As String)
' creates file from string contents
Dim tempFile As String
Dim nextFileNum As Long
nextFileNum = FreeFile
tempFile = FileName
Open tempFile For Output As #nextFileNum
Print #nextFileNum, Contents
Close #nextFileNum
End Sub
How should I change this code so that it does not turn the special unicode characters into question marks?