0

我正在尝试从直接显示 excel 文件的 Web 链接获取复制数据。当链接打开 excel 文件时,我无法右键单击并选择 HTML 代码的检查元素。(图片附件)

在此处输入图像描述

现在的任务是从这个文件中复制数据并粘贴到本地文件中。我可以访问该文件,但由于 HTML 代码不可访问,因此类方法不起作用。其次,正常的工作簿到工作簿代码也不起作用,因为其中一个工作簿是在线链接。以下是我拥有的代码,但它不起作用:

Sub OpenAndGetData()
Dim objIE As Object
On Error GoTo error_handler
Application.EnableEvents = True
Set objIE = CreateObject("InternetExplorer.Application")

With objIE
'(This is a direct link to the excel file that opens it online)
.navigate "myinternalinkhere"
objIE.Visible = True

End With

Workbooks("online_file.xlsx").Worksheets("sheet1").Range("B1:C500").Copy _
        Workbooks("local_file.xlsm").Worksheets("Sheet1").Range("A1")

Exit Sub

error_handler:
MsgBox ("Unexpected Error, I'm quitting.")
' objIE.Quit
Set objIE = Nothing



4

0 回答 0