如何获取"text-area" 元素的ID 为Google 进行翻译?

How to get the "text-area" element's ID of Google translate?

我正在尝试将一些单词自动输入到Google Translate by VBA 的"text area" 中,我使用"IE.Document.GetElementByID().SetAttribute()" 函数来输入单词。但是这个表达式中有一些语法错误,我找不到原因。

我试过"source"

文本区的ID
Dim IE As Object

Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True
IE.navigate "https://translate.google.com/?hl=zh-TW"
Do Until IE.busy
Loop
Call IE.Document.GetElementByID("source").SetAttribute("value, "Dummy")

我原以为 "Dummy" 会在我 运行 代码时自动输入到 Google 翻译的文本区域。页面可以打开,但是 "Dummy " 没有显示在文本区域,最后一行显示 "syntax" 错误。

这对我有用

Sub dothings()

    Dim objIE As InternetExplorer

    Set objIE = New InternetExplorer
    objIE.Visible = True

    objIE.navigate "https://translate.google.com"

    Do While objIE.Busy = True Or objIE.readyState <> 4: DoEvents: Loop

    objIE.document.getElementById("source").Value = "Hello world!"

End Sub

阅读这篇文章很有用http://automatetheweb.net/