PC Review


Reply
Thread Tools Rate Thread

Copy a workbook that already exists

 
 
=?Utf-8?B?YWJkcnVtcw==?=
Guest
Posts: n/a
 
      11th Jul 2007
I had a code that copy a TEMPLATE workbook and save it with new name that
depend on the value enetered on Textbox1. When the file exists, Excel gave a
msgbox and the user press Yes or No depends of they want to replace the file.
That I want is add to my code that when the user press "NO", my macro stop
running. How can I do that? My code is:

'**************************************************************************************
' Make a Template workbook copy. This copy will be named as the Lot Number
entered.
'*********************************************************
Set WkbTemp = Workbooks.Open(Filename:=tempFullName)

ActiveWorkbook.SaveAs Filename:="\\mypath\" & NewFileName & ".xls"
'THE LINE THAT I NEED TO ADD

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Already exists on the destination workbook ChrisP Microsoft Excel Worksheet Functions 3 11th Jul 2008 08:13 PM
Check if Workbook Exists dimm Microsoft Excel Programming 1 25th Mar 2008 02:08 AM
Help - How to check if value exists in closed workbook? c mateland Microsoft Excel Programming 3 16th Apr 2007 03:05 AM
How can I tell if a worksheet exists in a workbook using VB.NET ? =?Utf-8?B?Q2hyaXMgTGFuZQ==?= Microsoft Dot NET 2 18th Jan 2005 03:09 PM
Checking 2 c if workbook exists DavidMc Microsoft Excel Programming 4 5th Sep 2003 07:34 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:05 PM.