Results 1 to 20 of 81

Thread: How to change Date Picker content control format based on date comparison

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #11
    Hi macropod,

    It works, thanks a million. I placed the line near the beginning as you said...

    Sub FileSave()
      Dim strfName
        Call Document_ContentControlOnExit(ActiveDocument.SelectContentControlsByTitle("Visit Date - To")(1), False)
          With ActiveDocument
              If Len(.Path) = 0 Then
                  strfName = .ContentTypeProperties("RO").Value & Chr(32) & _
                  .CustomDocumentProperties("OfficeType").Value & Chr(32) & _
                  .ContentTypeProperties("Country(s)").Value & Chr(32) & _
                  .ContentControls(1).Range.Text & Chr(32) & _
                  .CustomDocumentProperties("ReportType").Value
                  .BuiltInDocumentProperties("Title").Value = strfName
              With Dialogs(wdDialogFileSaveAs)
                      .Name = strfName & ".docx"
                      .Show
                  End With
              Else
                 .Save
              End If
          End With
      End Sub
    May I bother you with two further issues that I came across:

    1. If the user has made a mistake in filling out the fields on the document information panel and the file has already been saved once, the macro no longer updates the Title field with any new values (I guess because of...
    If Len(.Path) = 0 Then
    Is it possible for the macro to always perform this check and update (if needed) before resuming with regular saves.

    2. Is it possible for the user to receive a message when two dates match or the From date is greater than the To date etc. At the moment the field in error shows 'on' for matching dates and "" for from > to and to < from. My may concern is that it's possible to Save the file with incorrect dates. The columns in the sharepoint library show blanks where the dates have been entered in error.

    Kind regards,

    JDS_916
    Last edited by JDS_916; 03-18-2014 at 08:49 AM.

Posting Permissions

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