Last post Dec 11, 2015 02:41 AM by Candice Zhou
Dec 10, 2015 07:51 PM|sajidsd|LINK
I am trying to merge 12 excel files (each having single excel-sheet) into single consolidated excel file that will have 12 excel-sheets using
Microsoft.Office.Interop.Excel liabrary and following error:
"Excel cannot insert the sheets into the destination workbook, because it contains fewer rows and columns than the source workbook. To move or copy the data to the destination workbook, you can select the data, and then use the Copy and Paste commands
to insert it into the sheets of another workbook."
I think its related to Microsoft Excel Application's DCOM objects permissions issue.
Can any one explains which type of permission are required to get the services of Microsoft Excel Application using DCOM Object.
Dec 11, 2015 02:41 AM|Candice Zhou|LINK
This error appears when you try to copy or move a metro image file sheet to a non-metro (XLS) sheet. Basically you’re trying to fit a much larger page into a small book and still expect the sizes to be equal.
First, you can open the XLS file that contains the macro and click File > Save As before you run the macro. Save the file as an XLSM file type (metro file with a macro). Then when running the macro, you are working two equally–sized workbooks. You can then
do another “Save As” to save the file back to the XLS legacy file format. The only drawback here is if you exceed the allowable rows and/or columns for legacy files.
Another workaround would be to use a copy and paste instead of a move or copy to copy the data that you need and paste that data into the XLS spreadsheet. Of course there are a couple of caviats with this solution. First, if you’re copying more than 65,536
rows of data or more than 256 columns of information then you won’t be able to paste it into the XLS file. You would get the same error message. Second, the code to copy and paste only the data you need is more involved than a one-line ‘Sheets.Move’ statement.