VBA Workbooks.Open() / method 'open' of object 'workbooks' failed

  • Thread starter Thread starter Luc Dindeman
  • Start date Start date
L

Luc Dindeman

Hi everyone,

I wrote a bit of VBA code that opens a .csv file from the internet given its
URL. Everything works fine when the URL's length is below or equal to 255
characters, but when the URL's length exceeds 255 characters I get either of
the following error messages

"method 'open' of object 'workbooks' failed"
"Run-time error 1004: Application-defined or object-defined error"

Below are two examples that can be tried in the VBA editor's Immediate
window to illustrate the issue with the actual URLs. The first one works and
the second fails :

Application.Workbooks.Open("http://download.finance.yahoo.com/d...BNP.PA+FORB.BR+EEV+FXP&f=sl1d1t1c1ohgv&e=.csv")

Application.Workbooks.Open("http://download.finance.yahoo.com/d...BNP.PA+FORB.BR+EEV+FXP&f=sl1d1t1c1ohgv&e=.csv")

Is there any way to work around this limitation ? Where is the limitation
coming from ?

I am using
MS Office Excel 2003 (11.5612.5606)
Microsoft Visual Basic 6.3

Any help is much appreciated.

- Luc
 
Back
Top