View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Peter T Peter T is offline
external usenet poster
 
Posts: 5,600
Default How do I copy an entire worksheet to another instance of excel?

Hi Alan,

If it's only data you want to copy, maybe adapt this snippet

Sub test()
Dim ws As Worksheet
Dim wb As Workbook
Dim xlAppDest As New Excel.Application
Set ws = ActiveSheet
Set wb = xlAppDest.Workbooks.Add

ws.Range("A1:z1000").Value = 1
With ws.UsedRange
wb.Worksheets(1).Range(.Address()).Value = .Value
End With
xlAppDest.Visible = True

Stop 'have a look

' as this is only a test ...
wb.Close False
Set wb = Nothing
xlAppDest.Quit
Set xlAppDest = Nothing
End Sub

Regards,
Peter T

If you avoid doing it that way, is there another route I could take?

The reason I was hoping to copy to another instance is that there are
a lot of settings tied down in the original application instance (cell
drag and drop / copy and paste - enough to render the application
fairly useless as an excel application but very safe for the data).