View Single Post
  #20   Report Post  
Posted to microsoft.public.excel.programming
Peter Rooney Peter Rooney is offline
external usenet poster
 
Posts: 325
Default Macro creates additional datafiles when saving copies of workb

Norman,

It's sorted.

I'm not quite sure how it happened, but earlier in the week, I changed the
format of the filenames to be created from beginning with an alpha to
beginning with a number. What was happening was, with all the concatenation
that was taking place to build up a filename consisting of labels, spacers
and three values brought in from various places on the worksheet, instead of
creating the filename IN the folder, the macro was creating the filename AS
the folder. Then, the next time the macro was run, the folder didn't exist,
so the document wasn't saved.

It seems to be working now, so i can come in from the sea (it was too cold
anyway)

Thank you VERY much for your persistence and advice, some of which has
contributed to my solving this problem.

Regards

Reggie



"Norman Jones" wrote:

Hi Peter,

Before you drown yourself (and I seem to recall that Reggie returned), try:

(1) deleting all code (including event code) and modules. What happens now
if you save the book ?

(2) Since you have access to another machine, still with the code deleted,
try saving the book on the second machine.


---
Regards,
Norman



"Peter Rooney" wrote in message
...
Norman,

I've conceded defeat.

I run my save code once, it works fine.

I run it again, it falls over with "document not saved"

I haven't got a clue why, especially as it was fine last week.

I work in Lytham St Annes, so i'm going to do a Reggie Perrin and run into
the sea.

Pete

"Norman Jones" wrote:

Hi Peter,

To eliminate residual doubt, are you saying that *all* temp files are
being
saved to :

D:\Pete's Operations\Personal\Archive

or just the temp files created by this particular workbook?

Were there any files or sub-folders in the %temp% folder and did you
delete
them?

Were there any files in the Windows\Temp folder and did you also delete
those?


---
Regards,
Norman



"Peter Rooney" wrote in message
...
D:\Pete's Operations\Personal\Archive

But, when I File Save As'd the file onto a floppy yesterday, a hash
file
appeared there, too!

I'm stumped. I'm wondering whether or not to re-create the workbook on
a
different PC, althoughI don't get this problem with other workbooks,
which
would tend to suggest that it isn't my workbook template that is
corrupted.

I wonder if my Workbook_Change code could be running during the save?

Regards

Pete




"Norman Jones" wrote:

Hi Peter,

The Temp files don't appear in my Temp folder

I assume that you mean the temp files created when you save the
problematic
file, not the temp files generally created by Excel. If this
assumption
is
correct, delete these files in addition to clearing the two folders
indicated in my last post.

If my assumption is incorrect, and you are saying that all temp files
are
being created in the workbook's folder, what is the full name and path
of
the folder?

---
Regards,
Norman


"Peter Rooney" wrote in
message
...
Hi, Norman,

The Temp files don't appear in my Temp folder - they appear in the
same
folder as the one where the Save As workbook is created - but I'll
try
this
anyway.

Pete


"Norman Jones" wrote:

Hi Peter,

Try closing Excel, rebooting the system and then deleting files and
sub-folders from your temp folder.

A quick way of navigating to the temp folder :

Start | Run | %temp% | OK

You might also clear files from the "C:\Windows\Temp" folder.


---
Regards,
Norman



"Peter Rooney" wrote in
message
...
Norman,

I created a brand new workbook and typed everything else in
again -
NO
copying and pasting from the original workbook at all.

I saved all the code in Notepad, created new modules and pasted
all
the
code
back in - and I STILL create duplicate files - not only when I
run
my
macro,
but when I do "File Save As" from the menu, too.

I might post on the normal Excel board, to see if anyone has any
ideas
about
what could be causing this corruption, as it certainly doesn't
seem
to
be
my
code - it happens anyway!

Regards

Pete



"Norman Jones" wrote:

Hi Pete,

Rob Boveys's addin is *very* frequently recommended by the
conoscenti
in
this group.

Given your problems, I would advocate running the CodeCleaner
*first*.

Including download, you will just about have time to drink a
coffee -
which
might also assuage your nerves!

---
Regards,
Norman



"Peter Rooney" wrote in
message
...
Hi, Norman,

I'll take a look at it - AFTER I get this thing working again,
and
AFTER I
take 74 backup copies when it does..! :-)

Pete



"Norman Jones" wrote:

Hi Peter,

You might first like to download Rob Boveys CodeCleaner addin
which
is
freely downloadable at:

http://www.appspro.com/Utilities/Utilities.htm

Run the dwnloaded Exe file to invoke an automatic
installation
routine.
Call
the CodeCleaner from the Tools menu.


---
Regards,
Norman



"Peter Rooney" wrote
in
message
...
Norman,

I'm recreating the workbook as we speak.

Hopefully copying and pasting the code won't carry the
corruption
over.

I'll let you know how I go on

Thanks again

Pete



"Norman Jones" wrote:

Hi Peter,

I've been experiencing application errors all morning
with the workbook in question.

I think that I would try to recreate your workbook.

Do you think the fact that the workbook's
corrupted in some way might lead to the erroneous file
being
saved
at
the
same time as the proper one?

Corrupt workbooks can cause strange phenomenons. It would
not
surprise
me
if
your reported:

filename made up of 8 random alphanumeric
characters.

was caused by corruption

When Excel saves a file it produces an intermediate,
temporary
copy
with
a
name such as you describe. It seems possible that this
temporary
copy
is
not being deleted.