View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Johnnyboy5[_2_] Johnnyboy5[_2_] is offline
external usenet poster
 
Posts: 99
Default Saving templete / workbook to a specific drive / file

I have a workbook template which when team members use it and the
they go to save it defaults to “my documents” and I would like to set
up a macro to save it to a particular drive / file location.

Below is one that works for a word template that I use, but I don’t
think it will work with an Excel file.

Excel 2003

Any Ideas ?

John


Credit to Graham Mayor

For these macros.

Sub FileSaveAs()
Dim sPath As String
sPath = "S:\Duty & Assessment\DAT ONLY" 'set the default save as path
for the document
On Error Resume Next
ChDir sPath 'Change to the directory you wish to save in
If Err.Number = 76 Then 'that folder doesn't exist

MsgBox sPath & " is not available on this PC?" & vbCr & "Select
the correct folder to save the document"
End If
With Dialogs(wdDialogFileSaveAs)

.Name = sPath & "\"
.Show 'show the save dialog
End With
End Sub


Sub FileSave()
Dim sPath As String
sPath = "S:\Duty & Assessment\DAT ONLY" 'set the default save as path
for the document
On Error Resume Next
If Len(ActiveDocument.Path) 0 Then 'the document has been previously
saved
ActiveDocument.Save 'so save the changes
Else 'The document has not been saved
ChDir sPath 'Change to the directory you wish to save in
If Err.Number = 76 Then 'that folder doesn't exist

MsgBox sPath & " is not available on this PC?" & vbCr & "Select
the correct folder to save the document"
End If
With Dialogs(wdDialogFileSaveAs)

.Name = sPath & "\"
.Show 'show the save dialog
End With
End If
End Sub