msgbox

Davers

Well-known Member
Joined
Sep 17, 2002
Messages
1,165
I'd like an error handler on my code...i've never created one before so I'm not quite sure how to go about it. The following code copies a folder and renames it in a new directory. I'd like it to check to see if the new folder it is being named to already exists, and if so give you the option to cancel. Here is the code:

Code:
Sub copyFDfiles()

Dim myDir As String
Dim myDest As String
Dim fs As New Scripting.FileSystemObject

myDir = Range("C11").Value
myDest = Range("C12").Value

fs.copyfolder myDir, myDest
    
End Sub

The myDest part is where it creates the new folder...

Any ideas?

Thanks,

Dave M.
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Thanks Andrew!! Great help as always!!

Have a great weekend! (y)

Dave M.
 
Upvote 0

Forum statistics

Threads
1,215,343
Messages
6,124,400
Members
449,156
Latest member
LSchleppi

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