-
1
- #1
Please help if you can. I have two spreadsheets and I want to copy the data from one into the other using copy and paste. I want to do this automatically from within Access.The code I have got is as follows:
Set oxlTemplateBook = oxlApp.Workbooks.Open("trending.xls"
Set oxlWorkbook = oxlApp.Workbooks.Open(sFilePath)
Set oxlWorksheet = oxlWorkbook.Sheets("qryTrdAvContractMileageToForeca"
oxlWorksheet.Columns("A:C".Select
oxlApp.Selection.Copy
oxlApp.Windows("Trending.xls".Activate
Set oxlTemplateSheet = oxlTemplateBook.Sheets("Contract To Forecast Data"
oxlTemplateSheet.Columns("A:C".Select
oxlApp.Selection.Paste
However when it gets to the second columns selection line an error occurs saying "Select method of range class failed"
What am I doing wrong?
Set oxlTemplateBook = oxlApp.Workbooks.Open("trending.xls"
Set oxlWorkbook = oxlApp.Workbooks.Open(sFilePath)
Set oxlWorksheet = oxlWorkbook.Sheets("qryTrdAvContractMileageToForeca"
oxlWorksheet.Columns("A:C".Select
oxlApp.Selection.Copy
oxlApp.Windows("Trending.xls".Activate
Set oxlTemplateSheet = oxlTemplateBook.Sheets("Contract To Forecast Data"
oxlTemplateSheet.Columns("A:C".Select
oxlApp.Selection.Paste
However when it gets to the second columns selection line an error occurs saying "Select method of range class failed"
What am I doing wrong?