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:


[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]mainID[/TD]
[TD]Value will be taken from named table[/TD]
[TD]From VBA[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]subIDType[/TD]
[TD]Value will be taken from named table[/TD]
[TD]From VBA[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]coreID[/TD]
[TD]Vlookup Formula to look for corresponding coreID with ref to mainID[/TD]
[TD]Formula[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]Concatenate[/TD]
[TD]Concatenate Formula that will combine 1,2,3 to form URL[/TD]
[TD]Formula[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.

Forum statistics

Threads
1,223,249
Messages
6,171,031
Members
452,374
Latest member
keccles

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