Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 05-14-2024, 06:38 AM
amankap amankap is offline Triggering Save As dialog box when updating a dotm file Windows 10 Triggering Save As dialog box when updating a dotm file Office 2021
Novice
Triggering Save As dialog box when updating a dotm file
 
Join Date: May 2024
Posts: 8
amankap is on a distinguished road
Default Triggering Save As dialog box when updating a dotm file


I have a macro that triggers a Save As dialog box whenever a custom dotm file was opened. I made a minor change to the macro, but now the Save As dialog box is not triggered when I open the dotm file. Can anyone provide guidance on what I might be missing? Thank you.


Code:
Sub AutoOpen()
    If ActiveDocument.CustomDocumentProperties.Count = 0 Then
        ActiveDocument.CustomDocumentProperties.Add Name:="AlreadyProcessed", LinkToContent:=False, Value:=1, Type:=msoPropertyTypeBoolean
        Call FormatCaptions
        Call CentreFigures
        Call SaveDoc
        Selection.HomeKey Unit:=wdStory
    End If
End Sub

Private Sub FormatCaptions()

...
Private Sub CentreFigures()
...

Private Sub SaveDoc()
    If ActiveDocument.Bookmarks.Exists("Title") Then
        ActiveDocument.BuiltInDocumentProperties("Title") = ActiveDocument.Bookmarks("Title").Range.Text
    Else
        ActiveDocument.BuiltInDocumentProperties("Title") = ActiveDocument.Name
    End If
    ActiveDocument.BuiltInDocumentProperties("Company") = "XYZ"
    ActiveDocument.BuiltInDocumentProperties("Author") = "ABC"
    ActiveDocument.BuiltInDocumentProperties("Last author") = "LMN"
    ActiveDocument.BuiltInDocumentProperties("Subject") = ""
    ActiveDocument.BuiltInDocumentProperties("Keywords") = ""
    ActiveDocument.BuiltInDocumentProperties("Category") = ""
    
    With Dialogs(wdDialogFileSaveAs)
        .Name = ActiveDocument.BuiltInDocumentProperties("Title")
        .Format = wdFormatXMLDocument  ' actually saves file as a DOCX
        If .Show Then
            .Execute
        End If
    End With
        
End Sub
Reply With Quote
 

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
instance a new dotm file from a Word dotm file and save with new file name David Peck Word VBA 3 08-18-2023 06:47 AM
Save a range of pages as PDF/New Word file with SaveAs Dialog box popup smj.javid Word VBA 3 10-11-2021 04:11 AM
Triggering Save As dialog box when updating a dotm file save dialog box promt doesn't save file brmveen Word VBA 2 11-04-2015 12:51 AM
Updating active R/O templates (dot) and macros (dotm) gw1500se Word 0 05-27-2014 12:11 PM
Triggering Save As dialog box when updating a dotm file How to deactivate File Save dialog box KIM SOLIS Word 3 12-15-2013 12:30 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 12:36 AM.


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