709-218-7927

The Landfall Garden House

60 Canon Bayley Road

CANADA A0C 1B0

CPRGreaves@gmail.com

Home

Christopher Greaves

File Diversion

Monday, September 19, 2011

Your new system came in today, and while you are all free to read Word documents from the old server, you are all supposed to save files to the new server on drive J:.

Here's some stripped-down proof-of-concept code:

Public Const strcNewDrive As String = "J:"

Sub FileSave()

MsgBox "FileSave"

If Len(ActiveDocument.Path) = 0 Then ' not previously saved

Call SaveAsDialog(strcNewDrive, ActiveDocument.Name)

Else

If UCase(Left(ActiveDocument.Path, 2)) = strcNewDrive Then ' User is logged on to th drive

ActiveDocument.Save

Else

Call SaveAsDialog(strcNewDrive, ActiveDocument.Name)

End If

End If

End Sub

Sub FileSaveAs()

MsgBox "FileSaveAs"

Call SaveAsDialog(strcNewDrive, ActiveDocument.Name)

End Sub

Function SaveAsDialog(strDrive As String, strName As String)

With Application.Dialogs(wdDialogFileSaveAs)

.Name = strDrive & "\" & strName

.Format = wdFormatDocument

.Show

End With

End Function

7092187927 CPRGreaves@gmail.com

Bonavista, Friday, December 04, 2020 5:54 PM

Copyright © 1996-2020 Chris Greaves. All Rights Reserved.