So this code I put jnder is saved in as a template master. We have new work numbers every time we get a job so we copy template in ever job...
So when I run this after filling out form it automatically saves in the job file number... Once we reopen in job folder everything is the same, we make changes and press that same macro same but now that it is the active same name it does not save
So macro saves in right directory, but when I try to change something once saved it gives me an error because same name exists
——————
So when I run this after filling out form it automatically saves in the job file number... Once we reopen in job folder everything is the same, we make changes and press that same macro same but now that it is the active same name it does not save
So macro saves in right directory, but when I try to change something once saved it gives me an error because same name exists
——————
VBA Code:
Sub SavingXLform()
FormDir = Range("FormPath") & "\" & IncomingPath & ((Range("Order") \ 10000) * 10000) & "\" & IncomingPath1 & ((Range("Order") \ 1000) * 1000) & "-" & ((Range("Order") \ 1000) * 1000) + 999 & "\" & Range("Order") & "\" & Range("FormDir4")
FormName = Range("Filename")
Response = MsgBox("Save As " & FormDir & "\" & FormName, vbOKCancel)
If Response = vbOK Then
If Dir(FormDir, vbDirectory) = "" Then
On Error GoTo DirErr
MkDir (FormDir)
End If
ChDir (FormDir & FormSubDir)
On Error GoTo SaveErr
ActiveWorkbook.SaveAs FileName:=FormDir & "\" & FormName _
, FileFormat:=xlOpenXMLWorkbookMacroEnabled, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
Response = MsgBox("File " & FormName & " was saved successfuly.", vbInformation)
Exit Sub
Else
MsgBox ("Operation Canceled.")
Exit Sub
End If
SaveErr:
Response = MsgBox("File save ERROR !", vbCritical)
Exit Sub
DirErr:
Response = MsgBox("Directory " & FormDir & " could not be created !", vbCritical)
MsgBox ErrorCode
MsgBox ("Form was not saved.")
End Sub
Last edited by a moderator: