vba - Resize Tables in Excel from Access -
the following code in theory should resize excel tables when run access. receive no errors when run tables in excel file not resize data in worksheets. appreciated!
dim appexcel object dim stworkbook object dim varname set appexcel = createobject("excel.application") set stworkbook = appexcel.workbooks.open("g:\home\riskmgtreports\reporting database\excel\dealerprofit.xlsx") each varname in array("dlr_all", "dlr_active_desc", "dlr_active_alpha", "dlr_active_upf", "dlr_term_alpha", "dlr_term_desc") stworkbook.worksheets(varname).listobjects("tbl" & varname) .resize stworkbook.worksheets(varname).range(varname) .databodyrange .interior.pattern = xlnone .borders.linestyle = xlnone end end next varname stworkbook.close savechanges:=true appexcel.quit set appexcel = nothing
it maybe not written vba, there c# solution sheet.columns.autofit(); sheet.rows.autofit(); maybe similar exists vba. seems close found here: http://www.vbaexpress.com/kb/getarticle.php?kb_id=40 in case : cells.entirecolumn.autofit
Comments
Post a Comment