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:

  1. transferspreadsheet identify query exported , outputted specific workbook , range: docmd.transferspreadsheet acexport, acspreadsheettypeexcel12, "qryname", "c:\path\to\excelspread\sheet.xlsx" true, "!worksheetname"

  2. 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

Popular posts from this blog

python - jinja2: TemplateSyntaxError: expected token ',', got 'string' -

Qt4: how to send QString inside a struct via QSharedMemory -

node.js - NodeJS remote terminal to Dropbear OpenWRT-Server -