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

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

matplotlib support failed in PyCharm on OSX -

python - Matplotlib: TypeError: 'AxesSubplot' object is not callable -