PDA

View Full Version : Force Save to specific Folder



ProteanBeing
02-18-2010, 10:25 AM
I have a template that is used by production personnel daily. Sometimes they forget to save on the server and instead save in My Documents. I would like to add something that would force the user to save in the folder that I want. Any ideas?

SamT
02-18-2010, 01:27 PM
Workbook_BeforeSave

See the BeforeSave Event and the SaveAs Method

If you can teach them to just cloe without saving, see the BeforeClose Event.

ProteanBeing
02-18-2010, 01:34 PM
I know this much. What code do I put into the Event macros to limit access to a specified folder. :banghead:

Philcjr
02-18-2010, 01:40 PM
Try something like this:

Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Filename:="C:\Documents and Settings\JoeSchmoe\My Documents\Test.xls"
Application.DisplayAlerts = True

GTO
02-18-2010, 01:51 PM
Not well tested, but maybe:

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)

Application.EnableEvents = False
Cancel = True
If CurDir <> "D:\2010\2010-02-13\" Then
ChDir "D:\2010\2010-02-13\"
End If
ThisWorkbook.Save
Application.EnableEvents = True

End Sub


Hope that helps,

Mark