在Windows 7中工作的Excel VBA在MAC OS上不起作用

时间:2019-04-01 20:25:02

标签: excel vba internet-explorer excel-vba-mac

我开始怀疑为什么在 Windows操作系统中运行良好的代码不能在 MAC OS 中运行。问题是我只是不知道MAC OS如何与VBA一起运行。请帮助我编写将在MAC OS中运行的代码,并从Internet上获取所需的数据。

该代码可在Windows 7中成功运行,但不能在MAC OS中运行。

Function abc(id As String, cost As String) As String

Application.ScreenUpdating = False

Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = False
IE.Navigate "https://sellercentral.amazon.com/fba/profitabilitycalculator/index?lang=en_US"

Application.StatusBar = "Submitting"
' Wait while IE loading...
While IE.Busy
    DoEvents
Wend

'*******************************************************
Delay 5
IE.Document.getElementById("search-string").Value = id
'IE.Document.getElementById("search-string").Submit
Delay 2
'IE.Document.getElementsByName("submit")(1).Click
IE.Document.getElementsByTagName("input")(3).Click
While IE.Busy
    DoEvents
Wend
Delay 3
IE.Document.getElementById("afn-pricing").Value = cost
Delay 1
IE.Document.getElementById("update-fees-link-announce").Click
Delay 2
abc = "$" & IE.Document.getElementsByClassName("barValue bold")(3).innerHTML

'*************************************
Application.StatusBar = "Submitted"
IE.Quit
Set IE = Nothing
Application.StatusBar = "Submitted"
Application.ScreenUpdating = True

End Function

0 个答案:

没有答案