使用 VBA 更改 Internet Explorer 编码

Change Internet Explorer encoding using VBA

我这边的 Internet Explorer 在 Encoding from VIew 菜单中设置为 Auto-Select。我想通过 VBA 代码将编码更改为 UTF-8 .. 我试过这样一行,但似乎没有按预期工作

ie.document.Charset = "utf-8"

知道如何实现吗?

你可以试试这个代码

Sub IEGetToKnow()
  Dim IE As InternetExplorer
  Set IE = New InternetExplorer
  With IE
    .Visible = True
    .Navigate2 "http://www.google.com.eg"
     While .Busy Or .readyState <> READYSTATE_COMPLETE:DoEvents:Wend
    .Document.Charset = "utf-8"
    .Refresh
 End With
End Sub