Consulting

Results 1 to 2 of 2

Thread: Get Recent folders in Save As Tab

  1. #1
    VBAX Newbie
    Joined
    Dec 2017
    Location
    Tune, Denmark
    Posts
    1
    Location

    Question Get Recent folders in Save As Tab

    Hi,

    I have written some vba code to run before save in the following method.
    Everything works fine, expect that the save as dialog not starts in the folder selected by the user.

    Eg. User click the marked folder, then I expect that the saveas dialog afterwards will start in this folder, but it starts in the default folder for the user.

    SaveAs_1.jpg SaveAs 2.jpg

    I can't use the Application.FileDialog, because this dialog is missing the properties, like manager, subject etc.

    My code is pasted here:
    Private Sub oApp_DocumentBeforeSave(ByVal Doc As Document, _
      SaveAsUI As Boolean, Cancel As Boolean)
        
        If (SaveAsUI = False And HasDocumentBeenSaved = False) Then
            Exit Sub
        End If
            
        If (ActiveDocument.AttachedTemplate <> "Normal.dotm") Then
            Dim intChoice As Integer
            Dim strPath As String
        
            If (HasDocumentBeenSaved = False Or SaveAsUI = True) Then
                With Dialogs(wdDialogFileSaveAs)
                    .name = SpecializedHelper.FileName
                    .Show
                End With
            Else
                ActiveDocument.Save
            End If
                    
            Cancel = True
        End If
    End Sub

  2. #2
    Graham Mayor - MS MVP (Word) 2002-2019
    Visit my web site for more programming tips and ready made processes
    http://www.gmayor.com

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •