Link to home
Start Free TrialLog in
Avatar of Victor  Charles
Victor CharlesFlag for United States of America

asked on

Help with creating one excel file with multiple workbooks from multiple excel files using VB.NET

Hi,

If I have the following three excel files: file1.xls, fil2.xls and file3.xls, how do I create file4.xls with three workbooks containing data
from file1.xls, file2.xls and file3.xls?, how do I name the workbooks same names as the filenames?

Thanks,

Victor
Avatar of Éric Moreau
Éric Moreau
Flag of Canada image

is it possible for you to think of using a component like http://www.aspose.com/.net/excel-component.aspx ?
I am also aware (but never used) of this free library: http://excelpackage.codeplex.com/
ASKER CERTIFIED SOLUTION
Avatar of louisfr
louisfr

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Victor  Charles

ASKER

Hi,

Thanks for the comments. Regarding the last comment, how do you include the three files in the loop to create one excel file?

Victor
Avatar of louisfr
louisfr

You call that method with the result file name as the result parameter and the three files as the sources parameter:
Merge("C:\MyPath\file4.xls", "C:\MyPath\file1.xls", "C:\MyPath\file2.xls", "C:\MyPath\file3.xls")

Open in new window

Hi,

What do I need to import in my project to use the code from the last post. The code I showing errors.

Thanks,

Victor
You need a reference to Microsoft.Office.Interop.Excel
Thank You.