number "1" added to filename

D

DarrenWood

When i open a spreadsheet that has been sent to me in an e mail instead
of it opening in excel with the same filename as it was recorded in the
e mail it adds a "1" to the end.

So file "expenses" becomes "expenses1"

Anyone know if you can stop this happening ?

Thanks

Darren
 
S

swatsp0p

My guess is that your email program is altering the file name, no
Excel. Try saving the file from the email and open it from the save
location.

Does that solve the problem?

Bruc
 
D

DarrenWood

Yes Bruce you are right, that does get around the problem, it is just a
pain in the rear !!

There must be a way around it to stop this happening, any ideas anyone?
 
D

DarrenWood

Ok, it might be a template but can you expand on that,

how do i know if it is ? and if it is how do i stop it renaming itsel
?

Thank
 
D

Dave Peterson

Find out where that email program stores its attachments.

=cell("filename",a1)

should show you.

Then clean that up every so often.

(I'm guessing that the number gets added when the email program finds an
existing file of the same name.)
 
D

DarrenWood

Hi Dave

Your spot on. If I open the e mail that has the file in and then ope
the file this opens up ok in excel with the correct file name.

However if after this i then close the e mail which contains the save
file whilst the file is still open in excel you get the normal reminde
"A program still has the file attachemnt " ".xls opem. changes t
this doc................."

If you then close the excel spreadsheet and then reopen outlook an
try to reopen the file this is when it gets renamed, and as you say i
you search on the file name it is in the C drive temp folder.

I assume this temp folder is cleared each time the pc is shut down
however any thoughts on how i could stop the file being stored in th
temp folder after i shut down the e mail containing the file
 
D

Dave Peterson

The files in the temp folder are deleted by the program that created them -- if
that program can and if that program is nice.

But not all files can be deleted (like when you close the email program before
closing the workbook in excel) and not all programs are nice.

I have a VBS script in a folder and a shortcut to it on my desktop.

Since there are lots of programs that fail to clean up after themselves, I like
to run it on demand--either right when I turn on the pc or right before I shut
it off.

It was written by Michael Harris:
http://groups.google.com/groups?threadm=#bXVsIHnAHA.920@tkmsftngp02
 
D

Dave Peterson

Does the attachment have a .xls extension or a .xlt extension.

If it has a .xlt extension, then it's probably a template. Excel will use that
for the basis of a new workbook.
 
D

DarrenWood

Mike

I tried using the code in the link you provided to clear out the tem
file.

Each time in run the code it stops at

redim preserve arfiles(count)

and gives the error message 'Compile error variable not defined'

any ideas?

Thanks

Darre
 
D

Dave Peterson

Mike?

That link to the .vbs code is not used in excel's VBA.

Open NotePad
copy Michael Harris's code there.
Save it as
deletetempfiles.vbs
(in a nice safe subfolder)

create a shortcut on your desktop to that .vbs file and double click on the
shortcut.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top