Copying worksheet from hidden instance of Excel

  • Thread starter Thread starter CG
  • Start date Start date
C

CG

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 before:=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.
 
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.


| 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 before:=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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top