L
Linda Martinis
We are using this macro to setup folders and files under another name. We
put in the Job Number and the files from the directory "STARTJOB" should copy
to the new Job # Directory. But it gets as far al the RetVal line and errors
out. Heres the macro, can someone please help us? Thanks in advance.
Sub Auto_Open()
Drive = "J:"
ChDrive Drive
BasePath = "J:\Jobs"
ChDir BasePath
Jobnum = ""
Message = "Please Enter The Job Number "
Title = "Select Job"
Jobnum = InputBox(Message, Title)
JobPath = "J:\Jobs\" + Jobnum
If Jobnum <> "" Then
If Dir(JobPath, 16) = "" Then
Title = "Setup Job " + Jobnum
Message = " "
YesNo = MsgBox(Message, 260, Title)
If YesNo = 6 Then
MkDir JobPath
DoEvents
ChDir JobPath
RetVal = Shell("J:|JOBS\XCOPY J:\JOBS\STARTJOB\*.* /S/E/V/Y")
Title = "Job " + Jobnum + " Created!"
Message = " "
YesNo = MsgBox(Message, 0, Title)
Else
Auto_Open
End If
End If
ChDir JobPath
End If
FName = Application.GetOpenFilename()
If FName <> False Then
Workbooks.Open (JobKitR)
End If
Exit Sub
End Sub
put in the Job Number and the files from the directory "STARTJOB" should copy
to the new Job # Directory. But it gets as far al the RetVal line and errors
out. Heres the macro, can someone please help us? Thanks in advance.
Sub Auto_Open()
Drive = "J:"
ChDrive Drive
BasePath = "J:\Jobs"
ChDir BasePath
Jobnum = ""
Message = "Please Enter The Job Number "
Title = "Select Job"
Jobnum = InputBox(Message, Title)
JobPath = "J:\Jobs\" + Jobnum
If Jobnum <> "" Then
If Dir(JobPath, 16) = "" Then
Title = "Setup Job " + Jobnum
Message = " "
YesNo = MsgBox(Message, 260, Title)
If YesNo = 6 Then
MkDir JobPath
DoEvents
ChDir JobPath
RetVal = Shell("J:|JOBS\XCOPY J:\JOBS\STARTJOB\*.* /S/E/V/Y")
Title = "Job " + Jobnum + " Created!"
Message = " "
YesNo = MsgBox(Message, 0, Title)
Else
Auto_Open
End If
End If
ChDir JobPath
End If
FName = Application.GetOpenFilename()
If FName <> False Then
Workbooks.Open (JobKitR)
End If
Exit Sub
End Sub