Merging workbooks

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ishan Bhalla

    #1

    Merging workbooks

    Hello,

    Am not sure if i have put this in the wrong discussion group.

    I have 2 workbooks with 1 worksheet each. I want to merge the workbooks into
    one. Any idea how to do it? I am using VB.net 2003

    Thanks in advance
    regards
    Ishan

  • Ahmed

    #2
    Re: Merging workbooks

    Try the following code. I just wrote it but didn't test it:

    Dim excelApp As New Excel.Applicati on
    excelApp.Workbo oks.Open("c:\bo ok1.xls")
    excelApp.Workbo oks.Open("c:\bo ok2.xls")

    excelApp.Workbo oks(1).Sheets.A dd(excelApp.Wor kbooks(2).Sheet s.Item("Sheet1" ))
    excelApp.Workbo oks(1).Save()
    excelApp.Workbo oks.Close()

    You need to include a reference to the excel library.

    Cheers,
    Ahmed
    Ishan Bhalla wrote:[color=blue]
    > Hello,
    >
    > Am not sure if i have put this in the wrong discussion group.
    >
    > I have 2 workbooks with 1 worksheet each. I want to merge the workbooks into
    > one. Any idea how to do it? I am using VB.net 2003
    >
    > Thanks in advance
    > regards
    > Ishan[/color]

    Comment

    Working...