P
polar
--------------------------------------------------------------------------------
Hi Everybody,
Thank you for having me on this forum.
Thanks to the help of some Excel users, I was able to get some code t
save an existing worksheet to a new workbook. However, when
duplication file name exists it prompts me to save as and if I clic
'No' I get a debug error message. I'd still like the 'save as' messag
to come up but is there a way I can get eliminate the debug erro
message if 'No' is clicked? This is so it just works normally whe
saving as a different file name or clicking no when an invoice i
accidentally duplicated.
Please see below code:
Code
-------------------
With Sheets("Invoice2")
Dim invName As String
Sheets("Invoice2").Select
invName = Range("L4").Value & ".xls"
Sheets("Invoice2").Copy
ChDir "C:\Users\Justin\Documents\Razza Jam"
ActiveWorkbook.SaveAs Filename:=invName
ActiveWorkbook.Close
End Wit
-------------------
Any help would be greatly appreciated.
Kind regards,
Brown Teddy Bea
Hi Everybody,
Thank you for having me on this forum.
Thanks to the help of some Excel users, I was able to get some code t
save an existing worksheet to a new workbook. However, when
duplication file name exists it prompts me to save as and if I clic
'No' I get a debug error message. I'd still like the 'save as' messag
to come up but is there a way I can get eliminate the debug erro
message if 'No' is clicked? This is so it just works normally whe
saving as a different file name or clicking no when an invoice i
accidentally duplicated.
Please see below code:
Code
-------------------
With Sheets("Invoice2")
Dim invName As String
Sheets("Invoice2").Select
invName = Range("L4").Value & ".xls"
Sheets("Invoice2").Copy
ChDir "C:\Users\Justin\Documents\Razza Jam"
ActiveWorkbook.SaveAs Filename:=invName
ActiveWorkbook.Close
End Wit
-------------------
Any help would be greatly appreciated.
Kind regards,
Brown Teddy Bea