Possible to copy/paste dirctory structure?

Flank

Registered User.
Local time
Today, 05:23
Joined
Jun 14, 2012
Messages
18
I have created a database that my company uses for project proposals.

Of course associated with any project is multiple documents that get stored in numerous locations.

I have created a blank directory structure that I copy/paste for each no project to the shared server drive.

Would it be possible to place a button in my project proposal form that will copy the template directory and place it in a predefined public place?

I was thinking I could use the MkDir command to make the first folder which would use the name of the project.

Than copy everything else to that parent directory.

The other problem I have run into, is I don't know how to make the VBA handle the name of the directory I want to use as it has spaces in it. (O:\Power & Industrial\Projects)

Cheers
 
Use the Xcopy command to copy your folder structure, like:

Code:
Dim SourcePath as string
Dim DestPath as string
SourcePath = "\\Whatever Source\"
DestPath = "\\Power & Industrial\Projects\"

shell "xcopy " & chr(34) SourcePath & chr(34) & " " & chr(34) & DestPath & chr(34) & " /T/E"
This sample would only copy the folder strucure no files. Do a xcopy /? in the command window to see more options.
I think the full path to the xcopy command is needed.
I recommend using the full sever path and not the windows drive mapping.
The chr(34) places double quotes arrond the file / path names to allow spaces.
 
I am getting a "compile error: expected end of statement" around the SourthPath Line.

I have modified the code to be relevant to my C drive for now.

Code:
Function FolderBuilder()
Dim SourcePath As String
Dim DestPath As String
SourcePath = "C:\Power & Industrial\Projects\Ztemplate"
DestPath = "C:\Power & Industrial\Projects\Ztemplate1"

shell "xcopy " & chr(34) SourcePath & chr(34) & " " & chr(34) & DestPath & chr(34) & " /T/E"

End Function

Am I just missing something simple?
 
I missed an "&" before SourcePath :D, you need to tell VBA what you want to do with two strings.
 

Users who are viewing this thread

Back
Top Bottom