Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 01-18-2018, 03:02 AM
mike_302 mike_302 is offline Set Default Filename: Title Composed of Two Document Properties Windows 7 64bit Set Default Filename: Title Composed of Two Document Properties Office 2010 64bit
Novice
Set Default Filename: Title Composed of Two Document Properties
 
Join Date: Jan 2017
Posts: 15
mike_302 is on a distinguished road
Default Set Default Filename: Title Composed of Two Document Properties

I want to set the content of one cell of a table to be the default suggested filename when you save a document. I already investigated and found that Word's first choice for this default file name is the Document title property, so I tried this -- but the problem is that the last number in the text of this cell (2000 in this case) is a Document Property box itself, for the purpose of repeating that number in other parts of the document. I can't put a Document Property box within the Title document property box, so does anyone have any other ideas?



See attachment for clarification
Attached Images
File Type: png Default Filename.png (9.2 KB, 16 views)
Reply With Quote
  #2  
Old 01-18-2018, 04:36 AM
Charles Kenyon Charles Kenyon is offline Set Default Filename: Title Composed of Two Document Properties Windows 10 Set Default Filename: Title Composed of Two Document Properties Office 2013
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,124
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

Here is some code that may help. I haven't tested it.

Code:
 Sub FileSave()
      ' Run as substitute for FileSave to add date to default document names
      ' Charles Kenyon 2017
      ' Appends date to Title Document property when saving
          On Error Resume Next
     
      If Len(ActiveDocument.Path) > 0 Then
        ' The document has already been saved at least once.
        ' Just save and exit the macro.
        ActiveDocument.Save
        Exit Sub
      End If
      '
        '
      Dim strName As String, dlgSave As Dialog
      Set dlgSave = Dialogs(wdDialogFileSaveAs)
      strName = ActiveDocument.BuiltInDocumentProperties("Title").Value 'get name in title
      strName = strName & " " & ActiveDocument.ContentControls(2).Range.Text 'add name from second content control
  '   Append current date
      strName = strName & " " & Format((Year(Now() + 1) Mod 100), "20##") & "-" & _
          Format((Month(Now() + 1) Mod 100), "0#") & "-" & _
          Format((Day(Now()) Mod 100), "0#") 'add date
      With dlgSave
          .Name = strName
          .Show
      End With
  End Sub
It would go in the template for your document and assumes the presence of the Content Control. It suggests rather than forces the name.

This also appends a date. That was in the code I'm using so I threw it in. You could comment it out or delete it.

Note this adds a space between the title and the control.

If your second part is a re-purposed document property content control, you could identify it as we did for the Title property.
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Title versus Titre in file properties... Gael Word 4 08-28-2015 07:59 AM
Set Default Filename: Title Composed of Two Document Properties Outlook 2010 Macro Save as MSG, Choose Destination, set default filename rslck Outlook 1 06-19-2014 10:16 AM
Set Default Filename: Title Composed of Two Document Properties Updating Document Properties without using advanced properties dialogue thedr9wningman Word VBA 3 01-20-2014 05:56 PM
Set Default Filename: Title Composed of Two Document Properties How to insert current date into default filename ? czomberzdaniela Word 1 12-27-2011 07:18 PM
Set Default Filename: Title Composed of Two Document Properties table composed from lines (drawing) czomberzdaniela Word Tables 8 04-12-2011 05:48 AM

Other Forums: Access Forums

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


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