Auto update of content controls

BobSullivan
3StarLounger
Posts: 235
Joined: 08 Jun 2010, 20:03
Location: Morgantown, PA

Auto update of content controls

Post by BobSullivan »

Hello,

I have a Word issue that would easily be fixed in Excel, but we have to use a Word table.

I'd like my user to enter a Sunday date in the first row of a table, and have the rest of the week dates automatically fill in. I've enclosed a sample document. We want to be able to enter a Sunday date in the first row, and have the other six dates fill in. Each cell in the first column needs to say the weekday name and the day when finished.

Thanks for any help.
You do not have the required permissions to view the files attached to this post.
Cordially,

Bob Sullivan
Elverson, PA

BobSullivan
3StarLounger
Posts: 235
Joined: 08 Jun 2010, 20:03
Location: Morgantown, PA

Re: Auto update of content controls

Post by BobSullivan »

Sorry, the document started out with content controls, thus the subject. But if it's easier without the controls, that's workable.
Cordially,

Bob Sullivan
Elverson, PA

User avatar
Charles Kenyon
4StarLounger
Posts: 596
Joined: 10 Jan 2016, 15:56
Location: Madison, Wisconsin

Re: Auto update of content controls

Post by Charles Kenyon »

Are you able to use macros in your work environment? If not, you would need fields, not content controls.
http://www.msofficeforums.com/word/3871 ... orial.html
Last edited by Charles Kenyon on 24 Nov 2021, 15:27, edited 1 time in total.

BobSullivan
3StarLounger
Posts: 235
Joined: 08 Jun 2010, 20:03
Location: Morgantown, PA

Re: Auto update of content controls

Post by BobSullivan »

yes, I'm comfortable with VBA
Cordially,

Bob Sullivan
Elverson, PA

User avatar
HansV
Administrator
Posts: 78236
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Auto update of content controls

Post by HansV »

Do you really need to do this in Word? This is the kind of thing Excel excels at...
Best wishes,
Hans

User avatar
Charles Kenyon
4StarLounger
Posts: 596
Joined: 10 Jan 2016, 15:56
Location: Madison, Wisconsin

Re: Auto update of content controls

Post by Charles Kenyon »

I agree with Hans that Excel is better.
In Word, with Content Controls, each control needs a tag and title.
You would want a Private Sub Document_ContentControlOnExit in the ThisDocument part of your vba project.
That would check for the tag or title of the content control and if it is your starting one, populate dates in the others in the desired format.
VBA date calculations are far easier than field date calculations.

BobSullivan
3StarLounger
Posts: 235
Joined: 08 Jun 2010, 20:03
Location: Morgantown, PA

Re: Auto update of content controls

Post by BobSullivan »

I agree it would be much easier in Excel. Unfortunately this is a local government form given to us in Word that we must fill out and submit. The final version needs to be a Word document. I'm just trying to make it easier for our person to fill the form out. Seems unnecessary to me that all 7 days must be filled out individually (as is set up now on the form). I'm trying to give our person the ability to just enter in one date per week.
Cordially,

Bob Sullivan
Elverson, PA

BobSullivan
3StarLounger
Posts: 235
Joined: 08 Jun 2010, 20:03
Location: Morgantown, PA

Re: Auto update of content controls

Post by BobSullivan »

How do I capture the value entered into a content control? I don't see a property.
Cordially,

Bob Sullivan
Elverson, PA

BobSullivan
3StarLounger
Posts: 235
Joined: 08 Jun 2010, 20:03
Location: Morgantown, PA

Re: Auto update of content controls

Post by BobSullivan »

found it. CoontentControl.Range.Text
Cordially,

Bob Sullivan
Elverson, PA

BobSullivan
3StarLounger
Posts: 235
Joined: 08 Jun 2010, 20:03
Location: Morgantown, PA

Re: Auto update of content controls

Post by BobSullivan »

Solution found and implemented. Thanks for your direction on this. :clapping:
You do not have the required permissions to view the files attached to this post.
Cordially,

Bob Sullivan
Elverson, PA

User avatar
HansV
Administrator
Posts: 78236
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Auto update of content controls

Post by HansV »

Thanks for the update!
Best wishes,
Hans

User avatar
Charles Kenyon
4StarLounger
Posts: 596
Joined: 10 Jan 2016, 15:56
Location: Madison, Wisconsin

Re: Auto update of content controls

Post by Charles Kenyon »

Glad we could help. Thank you for posting the solution. It may help others.