View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Wei-Dong Xu [MSFT] Wei-Dong Xu [MSFT] is offline
external usenet poster
 
Posts: 120
Default Copying Worksheets

Hi Tim,

I'd suggest you can use the code below to perform the copy operation.
'---------------------------------------------------------------------------
--------
Imports nsOff = Microsoft.Office.Core
Imports nsExcel = Microsoft.Office.Interop.Excel
'...
Dim xl As New nsExcel.Application
'specify the source workbook
Dim owb As nsExcel.Workbook =
xl.Workbooks.Open("G:\OfficeTest\psd.xls")
'specify the target workbook
Dim oTargetWb As nsExcel.Workbook =
xl.Workbooks.Open("G:\OfficeTest\scatter.xls")
owb.Worksheets.Copy(oTargetWb.Worksheets("sheet3") , )
oTargetWb.Save()
xl.Quit()
'---------------------------------------------------------------------------
--------

Please feel free to let me know if you have any question.

Best Regards,
Wei-Dong Xu
Microsoft Product Support Services
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.