Web query

eznsd

New Member
Joined
Oct 29, 2015
Messages
42
I started a thread entitled "Dynamic web query". That is working well except for one issue. Some parts for a certain vendor do not display correctly. I ran macros in an attempt to determine why. Although the eventual data returned is correct, the data pasted into my spreadsheet is not. While running the query, the two parts which failed did not go directly to the page I needed. The one that worked did. This is the query -

Code:
Sub Macro1()
'
' Macro1 Macro
'
'
    With ActiveSheet.QueryTables.Add(Connection:= _
        "URL;http://www.digikey.com/product-detail/en/LT1761ES5-BYP%23TRPBF/LT1761ES5-BYP%23TRPBFCT-ND/4694469" _
        , Destination:=Range("$A$1"))
        .Name = "4694469"
        .FieldNames = True
        .RowNumbers = False
        .FillAdjacentFormulas = False
        .PreserveFormatting = True
        .RefreshOnFileOpen = False
        .BackgroundQuery = True
        .RefreshStyle = xlInsertDeleteCells
        .SavePassword = False
        .SaveData = True
        .AdjustColumnWidth = True
        .RefreshPeriod = 0
        .WebSelectionType = xlSpecifiedTables
        .WebFormatting = xlWebFormattingNone
        .WebTables = "2"
        .WebPreFormattedTextToColumns = True
        .WebConsecutiveDelimitersAsOne = True
        .WebSingleBlockTextImport = False
        .WebDisableDateRecognition = False
        .WebDisableRedirections = False
        .Refresh BackgroundQuery:=False
    End With
End Sub
Sub Macro2()
'
' Macro2 Macro
'
'
    With ActiveSheet.QueryTables.Add(Connection:= _
        "URL;http://www.digikey.com/product-search/en?stock=1&keywords=LT3085IMS8E#PBF-ND" _
        , Destination:=Range("$A$15"))
        .Name = "en?stock=1&keywords=LT3085IMS8E#PBF-ND"
        .FieldNames = True
        .RowNumbers = False
        .FillAdjacentFormulas = False
        .PreserveFormatting = True
        .RefreshOnFileOpen = False
        .BackgroundQuery = True
        .RefreshStyle = xlInsertDeleteCells
        .SavePassword = False
        .SaveData = True
        .AdjustColumnWidth = True
        .RefreshPeriod = 0
        .WebSelectionType = xlSpecifiedTables
        .WebFormatting = xlWebFormattingNone
        .WebTables = "2"
        .WebPreFormattedTextToColumns = True
        .WebConsecutiveDelimitersAsOne = True
        .WebSingleBlockTextImport = False
        .WebDisableDateRecognition = False
        .WebDisableRedirections = False
        .Refresh BackgroundQuery:=False
    End With
    Range("B3").Select
    Windows("DK BOM.xlsm").Activate
    Range("F82").Select
    ActiveCell.FormulaR1C1 = "LT6654AHS6-5#TRMPBFCT-ND"
    Windows("Book1").Activate
    Range("A30").Select
End Sub
Sub Macro3()
'
' Macro3 Macro
'
'
    With ActiveSheet.QueryTables.Add(Connection:= _
        "URL;http://www.digikey.com/product-detail/en/LT6654AHS6-5%23TRMPBF/LT6654AHS6-5%23TRMPBFCT-ND/2485841" _
        , Destination:=Range("$A$30"))
        .Name = "2485841"
        .FieldNames = True
        .RowNumbers = False
        .FillAdjacentFormulas = False
        .PreserveFormatting = True
        .RefreshOnFileOpen = False
        .BackgroundQuery = True
        .RefreshStyle = xlInsertDeleteCells
        .SavePassword = False
        .SaveData = True
        .AdjustColumnWidth = True
        .RefreshPeriod = 0
        .WebSelectionType = xlSpecifiedTables
        .WebFormatting = xlWebFormattingNone
        .WebTables = "2"
        .WebPreFormattedTextToColumns = True
        .WebConsecutiveDelimitersAsOne = True
        .WebSingleBlockTextImport = False
        .WebDisableDateRecognition = False
        .WebDisableRedirections = False
        .Refresh BackgroundQuery:=False
    End With
End Sub

I cannot help to notice that the one's that failed have a number in the .Name field. Any help would be appreciated! Happy Thanksgiving everyone and thanks for the great tips I have received so far!
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
I see where the problem is, in the multiple part callouts. They both have what looks to be a % in the numbers. Now to figure out why.
 
Upvote 0

Forum statistics

Threads
1,223,236
Messages
6,170,912
Members
452,366
Latest member
TePunaBloke

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top