請將
sendkeys “%{A}”
改為
SendKeys "A"
即可正常執行。
下面提供一個另存網頁的範例:
Function SaveWebPage()
Set web = CreateObject("InternetExplorer.Application")
web.Visible = True
For i = 1 To 10
Dim WshShell
Set WshShell = CreateObject("WScript.Shell")
URL = "www.google.com"
web.Navigate URL
Do
Loop Until web.readystate = 1
WshShell.AppActivate (i)
WshShell.SendKeys "%F"
WshShell.SendKeys "A"
WshShell.SendKeys i
WshShell.SendKeys "{ENTER}"
WshShell.SendKeys "%F"
WshShell.SendKeys "C"
Next
End Function