CPGDeveloper
Board Regular
- Joined
- Oct 8, 2008
- Messages
- 190
I'm working on an Access Application -- through this application, I would like to be able to copy and paste a worksheet from one Excel workbook (which I'll call 'Previous' to the identically titled worksheet in an other workbook (which I'll call 'Current').
I've defined the two workbooks and sheets:
'prevmon, curmon, and dSheet have already been defined
Set prevxl = CreateObject("Excel.Application")
Set prevwk = prevxl.Workbooks.Open(prevmon)
Set curxl = CreateObject("Excel.Application")
Set curwk = curxl.Workbooks.Open(curmon)
Set prevsht = prevwk.Sheets(dSheet)
Set cursht = curwk.Sheets(dSheet)
I've tried several variations of the following to copy and paste, with no success:
prevsht.Range.Cells.Copy (cursht.Range("A1"))
I'm assuming it's a simple syntax that I'm missing -- any ideas would be greatly appreciated. Thank you in advance for your time.
I've defined the two workbooks and sheets:
'prevmon, curmon, and dSheet have already been defined
Set prevxl = CreateObject("Excel.Application")
Set prevwk = prevxl.Workbooks.Open(prevmon)
Set curxl = CreateObject("Excel.Application")
Set curwk = curxl.Workbooks.Open(curmon)
Set prevsht = prevwk.Sheets(dSheet)
Set cursht = curwk.Sheets(dSheet)
I've tried several variations of the following to copy and paste, with no success:
prevsht.Range.Cells.Copy (cursht.Range("A1"))
I'm assuming it's a simple syntax that I'm missing -- any ideas would be greatly appreciated. Thank you in advance for your time.