Can one VBA code execute commands in excel and access? -
is possible 1 vba code execute commands in both excel , access?
each day have 15 queries need copy/pasted specific sheets , places in excel workbook. information in queries updated everyday. i'm hoping write code insert results of these queries specific locations in excel.
would possible write 1 code of this?
yes, access maintains spreadsheet output capabilities including:
transferspreadsheet identify query exported , outputted specific workbook , range:
docmd.transferspreadsheet acexport, acspreadsheettypeexcel12, "qryname", "c:\path\to\excelspread\sheet.xlsx" true, "!worksheetname"
copyfromrecordset declare queries in dao or ado recordsets in vba , output resultset worksheet range:
ws.range("a2").copyfromrecordset rst
do note never need run queries in access except if action queries (append, update, delete). select queries, anytime in use (exported, called, or opened) query runs.
Comments
Post a Comment