Access VBA to copy specific sheets to another workbook (1 Viewer)

johnseito

Registered User.
Local time
Today, 09:01
Joined
Feb 27, 2013
Messages
89
Copy specific worksheets from one workbook to another workbook, rename and save them to a given directory.

'=============================

With excel VBA you can just copy it to another workbook by
recording a macro

1. First select all the sheets (you want) from one workbook
2. Right click and select "move or copy".
3. Check the check box "create a copy" and
4. Select new workbook in the drop down
5. Then click Ok

How to do this in Access VBA, if I can't do exactly what I can record
in macro can I just create a new work book and use VBA code to copy over specific sheets but keep the sheets of first workbook in tact and for the copied to workbook, to rename and save it to a directory ?

Thanks
 
Last edited:

isladogs

MVP / VIP
Local time
Today, 14:01
Joined
Jan 14, 2017
Messages
18,216
You've actually answered your own question.
Record the macro in Excel.

Now copy and paste that into an Access procedure
Precede that with code to open Excel.

Run the procedure.

With minor tweaks that should do it.

Oh yes, you'll need to add the VBA Microsoft Excel library reference unless you use late binding.
 

Users who are viewing this thread

Top Bottom