I am using VB.NET in my web application and just need to open and exiting Excel file, copy content of the worksheet A, and paste it to a worksheet of another (new or existing file)
I found some code in an old answers in EE post Q_21474186
xlsApp1 = CreateObject("Excel.Application")
xlsBook1 = xlsApp1.Workbooks.Open(path1) 'path1 is set and known prior to this
xlsApp1.DisplayAlerts = False
xlsApp1.Visible = False 'False to perform operations without viewing excel.
xlsApp2 = CreateObject("Excel.Application")
xlsBook2 = xlsApp2.Workbooks.Open(path2) 'path2 is set and known prior to this
xlsApp2.DisplayAlerts = False
xlsApp2.Visible = False 'False to perform operations without viewing excel.
When I run this I get follwing error:
System.Runtime.InteropServices.COMException: Paste method of Worksheet class failed
Please help me with this.