How to find what an error number means [{Solved}]

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Check out "Trappable Errors" in the VBA helpfile. They're listed there.

HTH,

Smitty
 
Upvote 0
Why are you trying to trap the error after it happens, why not prevent the error by checking for the files existance in the first place?
 
Upvote 0
It's Error 58 - "File already Exsists"

I just want to be able to if the file already exsists then add + 1 to the exsisting name. instead of overwriting the file or cancelling.

Does that make sense?

Michael
 
Upvote 0
Why not test for it:

<font face=Tahoma><SPAN style="color:#00007F">Sub</SPAN> File()
    <SPAN style="color:#00007F">Dim</SPAN> strfullname <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">String</SPAN>
        strfullname = "Drive\Path\Filename.xls"
    <SPAN style="color:#00007F">If</SPAN> FileExists(strfullname) <SPAN style="color:#00007F">Then</SPAN>
        MsgBox "You're in it"
    <SPAN style="color:#00007F">Else</SPAN>
        MsgBox "No sign of it!"
    <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN>
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN></FONT>

Smitty
 
Upvote 0
What I am trying to do, is create multiple files for 1 customer.
Example:
I have a SaveAs Cell(A1)

A1 = "MyCompany"
I need to SaveAs again as a 2nd MyCompany
Something like "MyCompany2"
then if I need a 3rd...
"MyCompany3"
etc. etc.

Make more sense?

Michael
 
Upvote 0

Forum statistics

Threads
1,215,335
Messages
6,124,327
Members
449,155
Latest member
ravioli44

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top