Excel not Closing in vba access module -


what's wrong on function below. excel.exe*32 not closing in task manager.

function formatexcel()     dim filename string     filename = "c:\this file\querycentering.xlsx"     set xl = new excel.application     set wb = xl.workbooks.open(filename)     wb.sheets(1)         columns("e:e").select         selection.numberformat = "m/d/yyyy"                  columns("c:c").horizontalalignment = xlcenter         rows("2:2").select          range(selection, selection.end(xldown)).select           selection.rowheight = 15       end     wb.save     wb.close true     set wb = nothing     xl.quit     set xl = nothing end function 

you have with wb.sheets(1), don't use it.

also, advisable not use selection object.

try (note . before columns)

with wb.sheets(1)     .columns("e:e").numberformat = "m/d/yyyy"             .columns("c:c").horizontalalignment = xlcenter end 

Comments

Popular posts from this blog

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

serialization - Convert Any type in scala to Array[Byte] and back -

SonarQube Plugin for Jenkins does not find SonarQube Scanner executable -