Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,080
Default 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   Report Post  
Posted to microsoft.public.excel.programming
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







  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy sheet cells into differnt workbook/sheet, How? IVLUTA Excel Discussion (Misc queries) 2 June 2nd 09 11:16 PM
copy from one sheet to another workbook Marilyn Excel Discussion (Misc queries) 1 May 26th 09 03:25 AM
Copy sheet to different workbook 3Nails Excel Discussion (Misc queries) 1 November 5th 08 07:28 PM
automatic copy and paste from sheet to sheet in a workbook ramseyjramseyj Excel Programming 6 December 11th 04 12:37 AM
Copy sheet from one workbook to another workbook problem Ron de Bruin Excel Programming 3 August 5th 04 07:19 PM


All times are GMT +1. The time now is 04:17 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"