i'm getting error in excel regarding assignment read-only property following code:
1    sub getsheets() 2    path = "c:where documents kept" 3    filename = dir(path & "*.csv") 4      while filename <> "" 5      workbooks.open filename:=path & filename, readonly:=true 6         each sheet in activeworkbook.sheets 7         sheet.copy after:=thisworkbook.sheets(1) 8      next sheet 9         workbooks(filename).close 10         filename = dir() 11      loop 12    end sub      
i'm guessing have posted code in thisworkbook module ?
thisworkbook represents workbook itself, has built-in (read-only) path property.  
rename path (e.g.) mypath , should ok.
sub getsheets()     'best use constant here...     const the_path string = "c:\where\my documents\are kept\"      dim filename string, wb workbook, sheet worksheet      filename = dir(the_path  & "*.csv")     while filename <> ""          set wb = workbooks.open(filename:=the_path & filename, readonly:=true)          each sheet in wb.sheets              sheet.copy after:=thisworkbook.sheets(1)          next sheet          wb.close          filename = dir()       loop end sub      
Comments
Post a Comment