从internet打开excel文档笨重

从internet打开excel文档笨重,excel,vba,internet-explorer,Excel,Vba,Internet Explorer,我正在为我的公司编写一个excel vba脚本,我在使它顺利工作时遇到了一些困难。为了让我的脚本完成它的工作,我需要打开两个excel文档,它们可以在我公司的内部网上找到。以下是我当前使用的代码: Sub checkForGrids() Dim IE As Object Dim link As String On Error Resume Next Set groupGrid = Workbooks(Sheet2.Cells(3, 2).value)

我正在为我的公司编写一个excel vba脚本,我在使它顺利工作时遇到了一些困难。为了让我的脚本完成它的工作,我需要打开两个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上单击ok,单击open并等待,然后单击ok并打开第二个文档。我的同事一弹出第二个ok按钮就点击它,导致了一个错误


有没有更顺畅的方法来实现这一点?我希望他们根本不必点击“打开”,但我一直找不到这样的方法。谢谢

您可以通过不使IE可见而安静地运行IE,停止屏幕更新并使用
应用程序.StatusBar
方法通知用户正在发生的事情


或者,您可以创建一个小用户表单,该表单在非模式状态下弹出,然后在运行所需代码时隐藏。

Workbooks.Open Sheet2.Cells(3,3).Value
假设单元格具有指向工作簿的HTTP链接