import Web-query, i.e. ".iqy file" inside a VBA code

drp92

New Member
Joined
May 23, 2013
Messages
22
Even though i can write little bit VB code, I am relative beginner, hence i would like if someone could help me with this.

I have set up a perfect loop, that changes cell values from named table

here is code:
Code:
Sub LoopThroughForEachCellInARange()


Dim OutputAddress As String
Dim rng As Range: Set rng = Application.Range("subIDType") 'value for B2
Dim cell As Range

Dim rng2 As Range: Set rng2 = Application.Range("mainID") 'value for B1
Dim cel2 As Range

For Each cel2 In rng2.Cells
    With cel2
        
        'Debug.Print .Value
        Worksheets("sheet1").Select
        Worksheets("sheet1").Range("B1") = .Value
        
        For Each cel In rng.Cells
            With cel
                
                'Debug.Print .Value  
                Worksheets("sheet1").Select
                Worksheets("sheet1").Range("B2") = .Value
                
            End With
        Next cel        
    End With
Next cel2

End Sub

now what i want is, i have set up a Web-Query that will take value for URL from the B4 and will get me the data.

How can I import/use the saved ".iqy file" inside above VBA code to take value from B4 as URL, OR
Have a web-query run to get data with B4 as URL



A sample dataset:


ABC
1mainIDValue will be taken from named tableFrom VBA
2subIDTypeValue will be taken from named tableFrom VBA
3coreIDVlookup Formula to look for corresponding coreID with ref to mainIDFormula
4ConcatenateConcatenate Formula that will combine 1,2,3 to form URLFormula

<tbody>
</tbody>
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().

Forum statistics

Threads
1,214,829
Messages
6,121,827
Members
449,051
Latest member
excelquestion515

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