Sub SaveFile()
Dim fname As String
Dim path As String
Dim SaveAs As String
If Len(Dir(Range("project_folder_link"), vbDirectory)) = 0 Then
SaveAs = Range("save_as2")
Range("used_product_name") = Range("pt_2")
Range("save_As_output") = Range("save_As2")
path = Range("file_Saved2")
Else
SaveAs = Range("save_as")
Range("used_product_name") = Range("pt_1")
Range("save_As_output") = Range("save_As")
path = Range("file_Saved")
End If
Range("tester") = SaveAs
If Len(Dir(SaveAs, vbDirectory)) = 0 Then
MkDir SaveAs
End If
If Len(Dir(Range("file_1"), vbDirectory)) = 0 Then
MkDir Range("file_1")
End If
If Len(Dir(Range("file_2"), vbDirectory)) = 0 Then
MkDir Range("file_2")
End If
If Len(Dir(Range("file_3"), vbDirectory)) = 0 Then
MkDir Range("file_3")
End If
If Len(Dir(Range("file_4"), vbDirectory)) = 0 Then
MkDir Range("file_4")
End If
If Len(Dir(Range("file_5"), vbDirectory)) = 0 Then
MkDir Range("file_5")
End If
If Len(Dir(Range("file_6"), vbDirectory)) = 0 Then
MkDir Range("file_6")
End If
If Len(Dir(Range("file_7"), vbDirectory)) = 0 Then
MkDir Range("file_7")
End If
If Len(Dir(Range("file_8"), vbDirectory)) = 0 Then
MkDir Range("file_8")
End If
If Len(Dir(Range("file_9"), vbDirectory)) = 0 Then
MkDir Range("file_9")
End If
If Len(Dir(Range("file_10"), vbDirectory)) = 0 Then
MkDir Range("file_10")
End If
If Len(Dir(Range("file_10.1"), vbDirectory)) = 0 Then
MkDir Range("file_10.1")
End If
If Len(Dir(Range("file_10.2"), vbDirectory)) = 0 Then
MkDir Range("file_10.2")
End If
If Len(Dir(Range("file_11"), vbDirectory)) = 0 Then
MkDir Range("file_11")
End If
If Len(Dir(Range("file_12"), vbDirectory)) = 0 Then
MkDir Range("file_12")
End If
If Len(Dir(Range("file_13"), vbDirectory)) = 0 Then
MkDir Range("file_13")
End If
If Len(Dir(Range("file_14"), vbDirectory)) = 0 Then
MkDir Range("file_14")
End If
If Len(Dir(Range("file_15"), vbDirectory)) = 0 Then
MkDir Range("file_15")
End If
If Len(Dir(Range("file_16"), vbDirectory)) = 0 Then
MkDir Range("file_16")
End If
If Len(Dir(Range("file_17"), vbDirectory)) = 0 Then
MkDir Range("file_17")
End If
If Len(Dir(Range("file_18"), vbDirectory)) = 0 Then
MkDir Range("file_18")
End If
Dim answer
Dim answer2
If Len(Dir(path)) <> 0 Then
answer = MsgBox("A 'Precast Bridge Design Template' has already been saved into this folder! Please check the folder before saving!", vbOKOnly, "Save ERROR")
Exit Sub
Else:
Application.ActiveWorkbook.SaveAs Filename:=path, FileFormat:=xlOpenXMLWorkbookMacroEnabled, CreateBackup:=False
answer2 = MsgBox("A 'Precast Bridge Design Template' has been saved into the Structural Folder for this project!", vbOKOnly, "File SAVED")
End If
Dim oWSH As Object
Dim oShortcut As Object
Set oWSH = CreateObject("WScript.Shell")
Set oShortcut = oWSH.CreateShortCut(Range("save_As_output") & "\" & _
"CANDE Folder.lnk")
With oShortcut
.TargetPath = Range("file_11")
.Save
End With
Set oWSH = Nothing
Set oWSH = CreateObject("WScript.Shell")
Set oShortcut = oWSH.CreateShortCut(Range("file_11") & "\" & _
Range("fName") & ".lnk")
With oShortcut
.TargetPath = Range("save_As_output")
.Save
End With
Set oWSH = Nothing
End Sub