I have this code to copy a sheet from a Workbook in VBA/Access to another Workbook/File.
Dim File1 as String
Dim File2 as String
File1 = "D:\File1.xls"
File2 = "D:\File2.xls"
Windows(File1).Activate
Sheets("Name of Sheet").Select
Sheets("Name of Sheet").Copy Before:=Workbooks(File2).Sheets("Name of Target Sheet")
This is not working. I need to copy in background.Also to disable any macros.
- How can I make it work?
- Can I give instead of "Sheet Name" an index?
- Can I give an array of indexes to copy to the second Workbook?