Hello All
This is my first post on this forum.
I have found some very useful information here to complete this task, but being a noob to VBA, can't put the pieces together.
(Sorry for the wording, English is only my third language.)
Your help is much appreciated.
_What I would like to do_
Based on values of a form create a directory and copy renamed files there, then open a folder and open a file.
*form*
value1
value2
value3
*create directory*
x:\directories\value1\value2\value3
If it exists, stop and give error message.
*create subdirectories*
x:\directories\value1\value2\value3\dir1
x:\directories\value1\value2\value3\dir2
*copy files*
x:\file_location\filename1.ext to x:\directories\value1\value2\value3\renamed_filename1.ext
x:\file_location\filename2.ext to x:\directories\value1\value2\value3\renamed_filename2.ext
*open folder*
x:\directories\value1\value2\value3
*open_file*
x:\directories\value1\value2\value3\renamed_filename1.ext
_What I have so far_
-for creating the directory value1:
Private Sub Command337_Click()
strPath = "X:\directories" & "\" & value1
If Len(Dir(strPath, vbDirectory)) = 0 Then
MkDir strPath
End If
-Need help with the error message.
-for creating the directory value2:
Private Sub Command337_Click()
strPath = "X:\directories" & "\" & value1 & value2
If Len(Dir(strPath, vbDirectory)) = 0 Then
MkDir strPath
End If
-Need help with the error message.
-for creating the directory value3:
Private Sub Command337_Click()
strPath = "X:\directories" & "\" & value1 & value2 & value3
If Len(Dir(strPath, vbDirectory)) = 0 Then
MkDir strPath
End If
-Need help with the error message.
FileCopy "x:\file_location\filename1.ext" ????
-Stuck here
-open folder
Shell "explorer.exe " & strPath, vbNormalFocus
-open file
-Stuck here
Thank you
This is my first post on this forum.
I have found some very useful information here to complete this task, but being a noob to VBA, can't put the pieces together.
(Sorry for the wording, English is only my third language.)
Your help is much appreciated.
_What I would like to do_
Based on values of a form create a directory and copy renamed files there, then open a folder and open a file.
*form*
value1
value2
value3
*create directory*
x:\directories\value1\value2\value3
If it exists, stop and give error message.
*create subdirectories*
x:\directories\value1\value2\value3\dir1
x:\directories\value1\value2\value3\dir2
*copy files*
x:\file_location\filename1.ext to x:\directories\value1\value2\value3\renamed_filename1.ext
x:\file_location\filename2.ext to x:\directories\value1\value2\value3\renamed_filename2.ext
*open folder*
x:\directories\value1\value2\value3
*open_file*
x:\directories\value1\value2\value3\renamed_filename1.ext
_What I have so far_
-for creating the directory value1:
Private Sub Command337_Click()
strPath = "X:\directories" & "\" & value1
If Len(Dir(strPath, vbDirectory)) = 0 Then
MkDir strPath
End If
-Need help with the error message.
-for creating the directory value2:
Private Sub Command337_Click()
strPath = "X:\directories" & "\" & value1 & value2
If Len(Dir(strPath, vbDirectory)) = 0 Then
MkDir strPath
End If
-Need help with the error message.
-for creating the directory value3:
Private Sub Command337_Click()
strPath = "X:\directories" & "\" & value1 & value2 & value3
If Len(Dir(strPath, vbDirectory)) = 0 Then
MkDir strPath
End If
-Need help with the error message.
FileCopy "x:\file_location\filename1.ext" ????
-Stuck here
-open folder
Shell "explorer.exe " & strPath, vbNormalFocus
-open file
-Stuck here
Thank you