ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Copying Data from Access to Excel in a macro (https://www.excelbanter.com/excel-worksheet-functions/118899-copying-data-access-excel-macro.html)

GLS

Copying Data from Access to Excel in a macro
 
Hi

I've been trying to set up a macro to copy & paste data from an Access Table
to an Excel Worksheet and I cant get it to work. It fails at the
'ActiveSheet.Paste' stage shown below.

Cells.Select
ActiveSheet.Paste
ActiveWorkbook.Save
End Sub

I created the macro starting in the Excel Worksheet, then going to the
Access Table, copying it, then returning to Excel and pasting the data in the
worksheet. As you can see from the VBA, it doesnt seem to have recorded any
of the Access part of the macro.

Any suggestions where I'm going wrong?

Many thanks

GLS
--
GLS

Dave F

Copying Data from Access to Excel in a macro
 
I would record a macro with the following steps:

1) In excel, go to Data--Get External Data
2) Select "Import External Data"
3) Navigate to the Access db and double-click on it
4) Select the table or query which you want to import into Excel
5) Click Ok.
6) Stop the macro recorder.

Dave
--
Brevity is the soul of wit.


"GLS" wrote:

Hi

I've been trying to set up a macro to copy & paste data from an Access Table
to an Excel Worksheet and I cant get it to work. It fails at the
'ActiveSheet.Paste' stage shown below.

Cells.Select
ActiveSheet.Paste
ActiveWorkbook.Save
End Sub

I created the macro starting in the Excel Worksheet, then going to the
Access Table, copying it, then returning to Excel and pasting the data in the
worksheet. As you can see from the VBA, it doesnt seem to have recorded any
of the Access part of the macro.

Any suggestions where I'm going wrong?

Many thanks

GLS
--
GLS


GLS

Copying Data from Access to Excel in a macro
 
Dave

Thanks - that worked great.

GLS
--
GLS


"Dave F" wrote:

I would record a macro with the following steps:

1) In excel, go to Data--Get External Data
2) Select "Import External Data"
3) Navigate to the Access db and double-click on it
4) Select the table or query which you want to import into Excel
5) Click Ok.
6) Stop the macro recorder.

Dave
--
Brevity is the soul of wit.


"GLS" wrote:

Hi

I've been trying to set up a macro to copy & paste data from an Access Table
to an Excel Worksheet and I cant get it to work. It fails at the
'ActiveSheet.Paste' stage shown below.

Cells.Select
ActiveSheet.Paste
ActiveWorkbook.Save
End Sub

I created the macro starting in the Excel Worksheet, then going to the
Access Table, copying it, then returning to Excel and pasting the data in the
worksheet. As you can see from the VBA, it doesnt seem to have recorded any
of the Access part of the macro.

Any suggestions where I'm going wrong?

Many thanks

GLS
--
GLS



All times are GMT +1. The time now is 10:36 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com