0
我正在爲我的公司寫一個excel vba腳本,並且在順利運行時遇到了一些麻煩。爲了使我的腳本能夠做到這一點,我需要打開兩個可在我公司的Intranet上使用的Excel文檔。以下是我目前正在使用的代碼:從互聯網打開excel文檔笨重
Sub checkForGrids()
Dim IE As Object
Dim link As String
On Error Resume Next
Set groupGrid = Workbooks(Sheet2.Cells(3, 2).value)
If groupGrid Is Nothing Then
MsgBox ("The Service Area Grid is required for this tool to run. Attempting to open now.")
Set IE = CreateObject("InternetExplorer.Application")
link = Sheet2.Cells(3, 3)
With IE
.Visible = True
.Navigate link
End With
End If
Set groupGrid = Workbooks(Sheet2.Cells(4, 2).value)
If groupGrid Is Nothing Then
MsgBox ("The Service Area Grid is required for this tool to run. Attempting to open now.")
Set IE = CreateObject("InternetExplorer.Application")
link = Sheet2.Cells(4, 3)
With IE
.Visible = True
.Navigate link
End With
End If
End Sub
這只是正常,但你必須點擊MSGBOX確定,單擊打開,單擊確定,並打開第二個文檔之前等待。我的同事在彈出後立即點擊第二個確定按鈕,導致錯誤。
有沒有更流暢的方法來完成這個?我希望他們不必點擊「打開」,但我一直無法找到這樣的方法。謝謝
'Workbooks.Open Sheet2.Cells(3,3).Value'假設單元格有一個到工作簿的HTTP鏈接 – 2014-11-26 05:45:55