When trying to run the below code in Access I get the following Run-time '1004' error:
"To paste all cells from an Excel worksheet into the current worksheet, you must paste into the first cell (A1 or R1C1)."
Set wkBkObj = Workbooks.Open("Somewhere" & strName)
Set wkBkName = Workbooks.Open("Somewhere\FileName.xlsx")
Set xlSheet = wkBkObj.Worksheets(1)
xlSheet.Cells.Copy
wkBkName.Worksheets(1).Paste <-------- Code hangs up here
xlSheet.Cells(1, 1).Copy
wkBkObj.Close
wkBkName.Save
wkBkName.Close
Set wkBkObj = Nothing
Set objFSO = Nothing
Set objFolder = Nothing
Set objFile = Nothing
Any ideas? Thanks in advance.
"To paste all cells from an Excel worksheet into the current worksheet, you must paste into the first cell (A1 or R1C1)."
Set wkBkObj = Workbooks.Open("Somewhere" & strName)
Set wkBkName = Workbooks.Open("Somewhere\FileName.xlsx")
Set xlSheet = wkBkObj.Worksheets(1)
xlSheet.Cells.Copy
wkBkName.Worksheets(1).Paste <-------- Code hangs up here
xlSheet.Cells(1, 1).Copy
wkBkObj.Close
wkBkName.Save
wkBkName.Close
Set wkBkObj = Nothing
Set objFSO = Nothing
Set objFolder = Nothing
Set objFile = Nothing
Any ideas? Thanks in advance.