View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Khaled Eid Khaled Eid is offline
external usenet poster
 
Posts: 2
Default Copy Sheet in another workbook

Hi,
from a VBA code I am trying to copy Sheet1 from book1 to book2. I use
the following code:
'****** Start Code *************
Dim ExcelApp As New Excel.Application
Dim ExcelAppx As New Excel.Application

ExcelApp.Workbooks.Open "D:\book2.xls", False, False
ExcelAppx.Workbooks.Open "D:\book1.xls", False, False

ExcelAppx.Visible = True
ExcelApp.Visible = True

ExcelAppx.Sheets("Gulf").Copy after:=ExcelApp.Sheets(1)
'****** End Code *************

when I run the above code I get the following error:
Run-Time error '1004'
copy method of worksheet class failed


Any good suggestions


Khaled Eid