I get run time error '5' when I run this code. any sugestions?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Sub FileCopyExample()
Dim oFSO As Object
Dim sSourcePath As String
Dim sTargetPath As String

Set oFSO = CreateObject("Scripting.FileSystemObject")

oFSO.CopyFolder "C:\PNTTEMPL\CustomDoc\*", "C:\PNTTEMPL\CustomDoc\TEST\"
Set oFSO = Nothing

End Sub
 
Hello Macrowriter,

You need to set a reference to the Scripting Runtime library in
project.

1. Open the VBA editor uising ALT + F11
2. Press ALT + T to drop down the Tools menu.
3. Press R to bring up the References dialog.
4. Search for the listing Microsoft Scripting Runtime
5. Click the checkbox on the left. A check mark indicates it is
selected.
6. Press Enter to close the dialog.
7. Press ALT + S to save the change to your project.

Sincerely,
Leith Ross
 

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

Back
Top