Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #3  
Old 11-02-2022, 06:10 AM
CellCharger CellCharger is offline Create additional CCs based on Combo Box selection Windows 10 Create additional CCs based on Combo Box selection Office 2019
Novice
Create additional CCs based on Combo Box selection
 
Join Date: Oct 2021
Location: NJ, USA
Posts: 24
CellCharger is on a distinguished road
Default

Thank you Graham for your response.

This is the existing macro. It adds 30 days in the due date field . I am not sure but it looks it it disappeared when I saved the file as DOCX.

Code:
Option Explicit

Private Sub Document_ContentControlOnExit(ByVal CCtrl As ContentControl, Cancel As Boolean)
Application.ScreenUpdating = False
Dim Dt As Date, StrDt As String
With CCtrl
  If .Title <> "Date of Initiation" Then Exit Sub
  If .ShowingPlaceholderText = True Then
    ActiveDocument.SelectContentControlsByTitle("Due Date")(1).Range.Text = ""
  Else
    StrDt = .Range.Text
    If IsDate(StrDt) Then
      Dt = CDate(StrDt)
    Else
      Dt = CDate(Split(StrDt, (Split(StrDt, " ")(0)))(1))
    End If
    ActiveDocument.SelectContentControlsByTitle("Due Date")(1).Range.Text = Format(Dt + 30, .DateDisplayFormat)
  End If
End With
Application.ScreenUpdating = True
End Sub
I also uploaded a macro enabled test form in the original post.

Last edited by CellCharger; 11-02-2022 at 09:36 AM.
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Text based on selection of dropdown list cloud67 Word VBA 2 08-09-2019 06:46 AM
Reveal portion of document based on dropdown selection chappeja Word VBA 1 03-27-2019 08:36 PM
Create additional CCs based on Combo Box selection Mail Merge Using Rules "IF" to add additional Text Based On Merge Field Content Alfred Mail Merge 2 05-23-2017 10:59 PM
text based on Combo box selection rosscortb Word VBA 3 03-16-2015 06:57 PM
Inserting a particular image based on a combobox selection LeonieD PowerPoint 2 06-27-2014 05:39 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 10:26 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