使用VBA从网页中提取数据,包括HYPERLINKS

时间:2022-10-29 13:38:33

I have extracted all the required data from a web page. Now the issue is that if the page contains any hyperlink then i have to extract the data with that hyperlinks also.I have attached the code for which the data is extracted.

我从网页中提取了所有必需的数据。现在的问题是,如果页面包含任何超链接,那么我也必须使用该超链接提取数据。我已经附加了提取数据的代码。

With ActiveSheet.QueryTables.Add(Connection:= _
        "URL;http://sienna/VBGSIWeb/Production/ItemStatus.aspx?item=" & PN, _
        Destination:=Range("$N$1"))
        .Name = "ItemStatus.aspx?item=BC-00003"
        .FieldNames = True
        .RowNumbers = False
        .FillAdjacentFormulas = False
        .PreserveFormatting = True
        .RefreshOnFileOpen = False
        .BackgroundQuery = True
        .RefreshStyle = xlOverwriteCells
        .SavePassword = False
        .SaveData = True
        .AdjustColumnWidth = False
        .RefreshPeriod = 0
        .WebSelectionType = xlSpecifiedTables
        .WebFormatting = xlWebFormattingNone
        .WebTables = """gvSAPRevHistory"""
        .WebPreFormattedTextToColumns = True
        .WebConsecutiveDelimitersAsOne = True
        .WebSingleBlockTextImport = False
        .WebDisableDateRecognition = False
        .WebDisableRedirections = False
        .Refresh BackgroundQuery:=False
    End With

`

`

I have also attached the snapshot of the webquerytable.

我还附上了webquerytable的快照。

使用VBA从网页中提取数据,包括HYPERLINKS

In this I have to copy and paste the CN# to desired cell including hyperlink.

在这里我必须将CN#复制并粘贴到所需的单元格,包括超链接。

1 个解决方案

#1


0  

Can you just turn on the Macro recorder and click through the steps you need to perform? I think that's your best bet. This doesn't seem to be a URL that any Tom, Dick, and harry can access. Good luck.

您是否可以打开宏录制器并单击您需要执行的步骤?我认为这是你最好的选择。这似乎不是任何Tom,Dick和Harry可以访问的URL。祝你好运。

#1


0  

Can you just turn on the Macro recorder and click through the steps you need to perform? I think that's your best bet. This doesn't seem to be a URL that any Tom, Dick, and harry can access. Good luck.

您是否可以打开宏录制器并单击您需要执行的步骤?我认为这是你最好的选择。这似乎不是任何Tom,Dick和Harry可以访问的URL。祝你好运。