Help with code

J

JayM

I'm not very good with writing code from scratch

I have written the below code but can't get it to work - what am I doing
wrong or is it just not possible to do.

The .bat file just copies some folders from one place to another.

Any help would be appreciated

Here is the code:
Sub ClientFolder()
' NewClient Folder Creation

Dim MyFilePath

MyFilePath = InputBox("Please Type the Alphabetical Letter you wish to
create your New Client Folder in:")
If MyFilePath = "A" Then
dRetVal = Shell("w:\data\_clients\A\_New Client.bat", Mode)
ElseIf MyFilePath = "b" Then
dRetVal = Shell("w:\data\_clients\B\_New Client.bat", Mode)
End If
End Sub
 
K

Kevin B

Rather than shell out you can user the copyfolder method.

In the example below o is delcared as an object and assigned a file system
object value. The next line copies from the source folder to the target
folder.

Sub CopyFolder()

Dim o As Object

Set o = CreateObject("Scripting.FileSystemObject")

o.CopyFolder "C:\Test1", "C:\Test2"

Set o = Nothing

End Sub
 

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

Top