I am struggling a little bit copy pasting cells from one Excel to another Excel file using another software. I have the following code (which I borrowed it from this thread) here:
Set objExcel = CreateObject("Excel.Application")
' Variables passed on from a software
' vTempRange is "A2:D14" and vFinalRange is something similar
vTempRange = WScript.Arguments.Item(0)
vFinalRange = WScript.Arguments.Item(1)
vReport = WScript.Arguments.Item(2)
' Open the workbook
Set x = Workbooks.Open("C:\sample.xlsx")
Set y = Workbooks.Open("C:\Final.xlsx")
' Set to True or False, whatever you like
objExcel.Visible = True
' Select the range on Sheet1 you want to copy
x.Worksheets("Sheet1").Range(vTempRange).Copy
' Paste it on Sheet2, starting at A1
y.Worksheets(vReport).Range(vFinalRange).PasteSpecial
' Activate Sheet2 so you can see it actually pasted the data
y.Worksheets(vReport).Activate
However, this returns me a 424 object required error when running through the other software. Could anybody give me some hints or solutions for this? Thank you!