[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.excel.programming

Workbook reopens after close

waxwing

12/13/2006 10:18:00 PM

I have a some code that uses GetOpenFilename to create an array of
filenames. Then one by one, the file is opened and a range is copied
to the orginal master file. After the copy procedure, the file is
closed and the next one is opened. This procedure seems to work ok but
after it completes, all of of the files seem to open up again.

Note the secondary files are copies of the master file that have been
sent to others for data collection. Therefore, they contain the same
VBA code as the master file. I have a feeling that the presense of
identical VBA code in these files may be causing the problem. Any
chance the macro is getting confused and picking up execution in one of
the other files?

Here's a simplified version of my code. When I run it, I check the
task bar at the MsgBox and have confirmed the secondary files are no
longer loaded. Immediately after clicking ok, those files are
reopened.

Help.

- John

2 Answers

cathellisuk

12/13/2006 10:43:00 PM

0

John,
did you forget to post your code?
Catherine

waxwing

12/13/2006 10:49:00 PM

0

Yes, I forgot to post my code but I just figured out the problem. I
had a Workbook_Open event running that included a timer for a short
delay. I added disabled events before opening the files and then
enabled events after closing the files and all works again.

Thanks for looking.

- John

On Dec 13, 4:17 pm, "John Michl" <waxwi...@gmail.com> wrote:
> I have a some code that uses GetOpenFilename to create an array of
> filenames. Then one by one, the file is opened and a range is copied
> to the orginal master file. After the copy procedure, the file is
> closed and the next one is opened. This procedure seems to work ok but
> after it completes, all of of the files seem to open up again.
>
> Note the secondary files are copies of the master file that have been
> sent to others for data collection. Therefore, they contain the same
> VBA code as the master file. I have a feeling that the presense of
> identical VBA code in these files may be causing the problem. Any
> chance the macro is getting confused and picking up execution in one of
> the other files?
>
> Here's a simplified version of my code. When I run it, I check the
> task bar at the MsgBox and have confirmed the secondary files are no
> longer loaded. Immediately after clicking ok, those files are
> reopened.
>
> Help.
>
> - John