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

Popular posts from this blog

Change php variable from jquery value using ajax (same page) -

Pull out data related to my apps from Android Play Store and iOS App Store -

How can I fetch data from a web server in an android application? -