I have a VBA routine that opens a new workbook in a new application using the following lines of code:
[VBA]
Set WoApp = CreateObject("Excel.Application")
Set WoBook = WoApp.Workbooks.Add
Set WoSheet = WoBook.Worksheets(1)
[/VBA]
I need to copy a worksheet from the source application into the new workbook. If MyBook is in the same Excel application as the source then this code will do it:
[VBA]Worksheets("mysheet").Copy After:=MyBook.Worksheets(1)[/VBA]
But this does not work for WoBook as it is in another Excel application.
WoBook is recognised by the source. The following code does work:
[VBA]WoSheet.Cells(1, 1) = "hello"[/VBA]
Any suggestions how to do the copying?