View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Homey Homey is offline
external usenet poster
 
Posts: 143
Default Copying worksheet from hidden instance of Excel

you cannot do this this way. you should open workbooks in first instance of
excel and copy sheets between workbooks. no reason to use a second instance
of excel even if this did work.


"CG" wrote in message
...
| Is it possible to open multiple worksheets in a hidden instance of
| Excel and copy worksheets to a workbook in the original visible
| instance? I want to open multiple files and would prefer to not see
| all the files being opened in the windows task bar?
|
| wb was opened in a hidden instance of excel. An error occurs at the
| ws.copy line.
|
| The error is: "Method 'Copy' of object '_Worksheet' failed"
|
| Is there another option avoid seeing the files being opened in the
| task bar?
|
| application.screenupdating = false
|
| Set wb1 = ActiveWorkbook
|
| Set wb = xlApp.Workbooks.Open(fs.FoundFiles.Item(i))
|
| For Each ws In wb.Worksheets
| ws.Copy befo=wb1.Sheets(wb1.Sheets.Count)
| Next ws
|
| application.screenupdating = true
|
| I am using XP sp3 with Excel 2003
|
| I have it working by inserting worksheets and copying the usedrange.
| I would prefer to copy the whole worksheet.