Make Word 2100 remember the last location it saved or opened a document

Discussion in 'Application Software' started by hard__ware, Aug 24, 2010.

  1. hard__ware

    hard__ware MDL Novice

    Aug 17, 2010
    5
    0
    0
    #1 hard__ware, Aug 24, 2010
    Last edited by a moderator: Apr 20, 2017
    Make Word 2010 remember the last location it saved or opened a document

    Here are some Macro's for Word 2010 that allows it to Remember the last
    Location you Saved too or Opened a Document From.

    The code is not 100% Optimized, but does work as expected ...

    Has not been tested with Word 2007 ...

    Add these Macro's to your Normal.dotm

    Code:
    Sub FileOpen()
        FilePath (wdDialogFileOpen)
    End Sub
    
    Sub FileSave()
        FilePath ("Save")
    End Sub
    
    Sub FileSaveAs()
        FilePath (wdDialogFileSaveAs) 
    End Sub
    
    Function FilePath(iDialog)      
        Dim MyString As String
        uProfile = Environ("USERPROFILE")
        
        If FileOrDirExists(uProfile & "\FilePath.txt") Then
            Else: GoTo SkipInput
        End If
        
        Open uProfile & "\FilePath.txt" For Input As #1
        Do While Not EOF(1)
            Line Input #1, MyString
        Loop
        Close #1
        
        ChangeFileOpenDirectory MyString
        
    SkipInput:
        If iDialog = "Save" Then
            ActiveDocument.Save
        Else
            Set nDialog = Dialogs(iDialog)
            On Error Resume Next
                With nDialog
                    .Show
                End With
            On Error GoTo 0
        End If
                
        Open uProfile & "\FilePath.txt" For Output As #2
            Write #2, CurDir()
        Close #2
        
    End Function
    
    Function FileOrDirExists(PathName As String) As Boolean
        Dim iTemp As Integer
         
        On Error Resume Next
        iTemp = GetAttr(PathName)
         
        Select Case Err.Number
        Case Is = 0
            FileOrDirExists = True
        Case Else
            FileOrDirExists = False
        End Select
         
        On Error GoTo 0
    End Function
     
  2. antman67

    antman67 MDL Novice

    Aug 26, 2010
    18
    0
    0
    WOW this is an AWESOME TIP! How can I do the same for my Microsoft Frontpage to remember last open location?
     
  3. Gillani

    Gillani MDL Novice

    Nov 18, 2012
    1
    0
    0
    God bless you Sir.
    Much obliged.