Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 03-17-2016, 10:41 AM
JonFleming JonFleming is offline Force save after opening a template based file Windows 10 Force save after opening a template based file Office 2016
Novice
Force save after opening a template based file
 
Join Date: Feb 2016
Posts: 15
JonFleming is on a distinguished road
Default Force save after opening a template based file

My boss wants to set up our internal templates so that the user is forced to save the new document immediately upon opening it. In some of them the only VBA will be the save-forcer, in others there are macros that should be preserved. Here's what I have:

Code:
Private Sub Document_New()
    Dim intChoice As Integer
    Dim strPathName As String
            
    intChoice = 0
    While intChoice = 0
        intChoice = Application.FileDialog(msoFileDialogSaveAs).Show
        If intChoice <> 0 Then
            strPathName = Application.FileDialog(msoFileDialogSaveAs).SelectedItems(1)
            If Right$(strPathName, 1) = "x" Then
                strPathName = Left$(strPathName, Len(strPathName) - 1) & "m"
            End If
            ActiveDocument.SaveAs2 FileName:=strFileName, FileFormat:=wdFormatXMLDocumentMacroEnabled
        End If
    Wend
End Sub
But this saves as a docx (I don't trust the users to select docm).

Suggestions on how to delete this code after running are welcome.
Reply With Quote
 

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Force save after opening a template based file How to Force a "Save As" for a fillable form cbalogh Word 6 01-27-2014 05:50 PM
Force save after opening a template based file save as filtered HTML – force graphics format to .png eNGiNe Word 2 01-23-2014 06:27 AM
Force save after opening a template based file Force User to Save As lgillespie Word 6 09-09-2013 03:13 PM
Force save after opening a template based file VBA Code to force 'Save As' rossi45 Excel Programming 1 05-11-2012 03:05 PM
Template "File In Use" when opening 2 documents based on the same template wendt Word 5 12-15-2009 12:37 AM

Other Forums: Access Forums

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


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