Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copy Sheet in another workbook
Perhaps (untested):
ExcelAppx.Workbooks("book1.xls").Sheets("Gulf").Co py _ After:=ExcelApp.Workbooks("book2.xls").Sheets(1) Not quite sure why you need to open 2 instances of Excel, though. -- Vasant "Khaled Eid" wrote in message ... 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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copy Sheet in another workbook
Thanks a Lot it worked fine, definitly I am using one instant of excel but
the code I wrote is one of the tests that I am trying to check. Anyway thank you again, I appreciate it "Vasant Nanavati" <vasantn *AT* aol *DOT* com wrote in message ... Perhaps (untested): ExcelAppx.Workbooks("book1.xls").Sheets("Gulf").Co py _ After:=ExcelApp.Workbooks("book2.xls").Sheets(1) Not quite sure why you need to open 2 instances of Excel, though. -- Vasant "Khaled Eid" wrote in message ... 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Copy sheet cells into differnt workbook/sheet, How? | Excel Discussion (Misc queries) | |||
copy from one sheet to another workbook | Excel Discussion (Misc queries) | |||
Copy sheet to different workbook | Excel Discussion (Misc queries) | |||
automatic copy and paste from sheet to sheet in a workbook | Excel Programming | |||
Copy sheet from one workbook to another workbook problem | Excel Programming |