Using MS Access to run code in excel vba

前端 未结 4 1892
迷失自我
迷失自我 2021-01-16 02:36

I pull a query off SQL Server using an access front-end. I then export the recordset to a new Excel workbook. I want to then use excel to run code that I have in Access. It

4条回答
  •  一整个雨季
    2021-01-16 03:08

    If I understood you correctly, that you copied a code from Access to Excel and run the same code in Excel, in both cases the code manipulates the spreadsheet, and the one in Excel is fast, and the other in Access is slow, you can try the following:

    • hide Excel window (ActiveWorkbook.Windows(1).Visible = False), check also here
    • halt recalculation of the worksheet - check this
    • write the same function in Excel sheet (as a template file) and only run it from Access

    I hope this helps.

    Normally, automation is much slower than a macro (vba code). The same applies to other applications, eg. MS Word.

提交回复
热议问题