Saturday, 15 March 2014

excel - Run-time error 1004 - opening a workbook hyperlink -



excel - Run-time error 1004 - opening a workbook hyperlink -

i trying write simple code looping through .xls files japanese site. while making framework run runtime 1004 problem - www.e-stat...could not found, yet the files available. here's code. if tell me i'm going wrong, that'd splendid. ps - i've tried looking reply everywhere on internet.

sub automate() dim wb workbook dim filepath string thswb = thisworkbook.name 'worksheets("data").activate 'dim namearray integer dim myarray(1 4) integer myarray(1) = 0 myarray(2) = 1 myarray(3) = 2 myarray(4) = 7 = 1 ubound(myarray) workbooks.open "www.e-stat.go.jp/sg1" & "/estat/xlsdle.do?sinfid=00002723131" & myarray(i) 'do stuff 'in progress activeworkbook.close next end sub

fully qualify url protocol , assign handle wb.

sub automate() dim wb workbook dim filepath string, thswb string, integer thswb = thisworkbook.name 'worksheets("data").activate 'dim namearray integer dim myarray(1 4) integer myarray(1) = 0 myarray(2) = 1 myarray(3) = 2 myarray(4) = 7 = 1 ubound(myarray) set wb = workbooks.open("http://www.e-stat.go.jp/sg1" & "/estat/xlsdle.do?sinfid=00002723131" & myarray(i)) wb 'do stuff 'in progress end wb.close set wb = nil next end sub

i ran code above modification , able open 4 workbooks.

excel vba excel-vba runtime-error

No comments:

Post a Comment