ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copying worksheet from hidden instance of Excel (https://www.excelbanter.com/excel-programming/442826-copying-worksheet-hidden-instance-excel.html)

CG[_4_]

Copying worksheet from hidden instance of Excel
 
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.

Homey

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.



All times are GMT +1. The time now is 09:12 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com