View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
[email protected] larrysulky@gmail.com is offline
external usenet poster
 
Posts: 2
Default active workbook/sheet

On Jan 23, 4:41*pm, JLGWhiz wrote:

Hmm...

Originally I did have steps 5 and 6 in the opposite order; I would
close the workbook (with its new name), then try to reopen the
original workbook. But since the macro was stored inside the workbook
itself, it stopped executing once the workbook was closed. I figured
(hoped) that by re-opening the original file...

Oh.

Now I get what you're saying. The instance of the macro that's running
stops when the first workbook is closed. The fact that the workbook
that gets reopened has identical code in it is irrelevant. That's not
the instance that is running. The instant I close the first workbook,
the macro processing stops.

I'll need to rethink this. I'd like an easy way to retain all the
column definitions; it seems that "save as" ought to be part of the
solution, rather than setting up an array to hold all the column
definitions (and I don't know how many columns there will be from one
spreadsheet to another.

Maybe I need to store the macro in a separate template file?

Thanks for your help, Whiz

I am not even sure that alone will cure the problem. *But what was happening
was *that you were closing the workbook that was actively running the code. *
Since I didn't see the code, I assume you can use a macro to open the
original file and execute the delete. *

The way you have it, the original workbook is opened in a second instance,
so when you execute the close of the save-as filename copy, it loses
communication with the second instance of the original.