querytable error

venkat1926

Well-known Member
Joined
Aug 21, 2005
Messages
4,824
I have the following code

the red color lines give error "unable to open.............". when I click ok in the error emssage and go further the
higher size lines work and download the data for the period.
what mistake am I doing in the codes above the line '------------
particularly red colored lines?

I can think that there are doube quotes in the hgher size code lines and wonder whether these give problem.
thank you

Code:
Sub data2()
stock = "adhunik"
Dim constring As String
dte1 = "06-12-2008"
dte2 = "06-02-2009"
constring = "URL;http://nseindia.com/content/equities/scripvol/datafiles/" & dte1 & "-TO-" & dte2 & stock & "XN.csv"
'MsgBox constring
[SIZE="4"][COLOR="Red"]With ActiveSheet.QueryTables.Add(Connection:=constring, Destination:=Range("A1"))
.Refresh
End With[/COLOR][/SIZE]

'============================


[FONT="Arial Black"][SIZE="5"]wiith ActiveSheet.QueryTables.Add(Connection:= _
        "URL;http://nseindia.com/content/equities/scripvol/datafiles/06-12-2008-TO-06-02-2009ADHUNIKXN.csv" _
        , Destination:=Range("A1"))
        .Refresh
        End With[/SIZE][/FONT]
End Sub
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Thanks Richard for prompt reply.
that also did not help as a mater fact the lower code also sometimes gives problem. I suspect this is a problem with the web page. Let me try tomorrow again
thanks once again.
 
Upvote 0

Forum statistics

Threads
1,223,234
Messages
6,170,891
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