Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 12-24-2017, 06:39 AM
Testpilot.dk Testpilot.dk is offline Get Recent folders from "Save As" Tab Windows 10 Get Recent folders from "Save As" Tab Office 2016
Novice
Get Recent folders from "Save As" Tab
 
Join Date: Dec 2017
Posts: 2
Testpilot.dk is on a distinguished road
Question Get Recent folders from "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.

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

My code is pasted here:
Code:
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

Reply With Quote
  #2  
Old 12-24-2017, 09:58 PM
gmayor's Avatar
gmayor gmayor is offline Get Recent folders from &quot;Save As&quot; Tab Windows 10 Get Recent folders from &quot;Save As&quot; Tab Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,101
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

Gven that your macro has assorted variables that are not declared and we have no idea what they refer to and has others which are declared and are not used or the values are not known, it is not possible to guess where the problem lies - but start by investigating
Code:
.name = SpecializedHelper.FileName
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
  #3  
Old 12-25-2017, 12:48 PM
Testpilot.dk Testpilot.dk is offline Get Recent folders from &quot;Save As&quot; Tab Windows 10 Get Recent folders from &quot;Save As&quot; Tab Office 2016
Novice
Get Recent folders from &quot;Save As&quot; Tab
 
Join Date: Dec 2017
Posts: 2
Testpilot.dk is on a distinguished road
Default Let's focus on the issue

Hi,

Let us focus on my real issue and not my variables and so on.

If we focus on this piece of code.
Code:
Public WithEvents oApp As Word.Application

SystemManager.oApp = Word.Application

Private Sub oApp_DocumentBeforeSave(ByVal Doc As Document, _
  SaveAsUI As Boolean, Cancel As Boolean)

With Dialogs(wdDialogFileSaveAs)
                .name = "SomeSpecificFileName"
                .Show
            End With
End Sub
My Issue is, when I use the dialog like the above, It simple "forget" the path selected in the recent history on "Save As" tab,

If I instead put the following in to the code, it will open the save as dialog in the rigth folder.
Code:
Public WithEvents oApp As Word.Application

SystemManager.oApp = Word.Application

Private Sub oApp_DocumentBeforeSave(ByVal Doc As Document, _
  SaveAsUI As Boolean, Cancel As Boolean)

With Dialogs(wdDialogFileSaveAs)
                .name = "C:\Temp\SomeSpecificFileName"
                .Show
            End With
End Sub
My question is how can I get the path of the selected folder from the "Save As" tab?

Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Get Recent folders from &quot;Save As&quot; Tab Word 2010 "Save As" has no folders EweWho Word 17 06-05-2017 09:40 AM
Get Recent folders from &quot;Save As&quot; Tab Word doc is opened on recent list, pop up: "you don't have permission to open", deleted. wordhasfailedmetwice Word 3 11-17-2016 04:09 PM
How to use a "Save As" button without causing digital signatures to become "Invalid"? jferg Word VBA 0 02-16-2016 03:04 PM
"Open Recent" and "More..." in Excel and Word BudVitoff Office 0 04-03-2015 09:17 PM
Disable "Save" & "Save As" & "Print" ribbon Villalobos Word VBA 3 07-14-2014 11:37 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:09 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft