![]() |
#1
|
|||
|
|||
![]()
Hi,
I am looking to create custom document properties that can be referenced throughout a document with content controls and modified from a single location within the document. The file referenced in this link (CCtrl DocProp.zip) is exactly what I am aiming for, however I am unsure how to replicate this in the document I am using or create any additional. I am fairly new to working outside of bare bones Microsoft Word so a good amount of this is difficult for my head to wrap around, but any help would be extremely appreciated! |
#2
|
||||
|
||||
![]()
Post #4 in that thread explains how the setup was created.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
||||
|
||||
![]()
Have a look at the template developed by Greg Maxey and described here https://gregmaxey.com/word_tip_pages...rol_tools.html
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
#4
|
|||
|
|||
![]()
Thanks, I just realized what I was doing wrong before. Is there a way to modify the code to work with dates as well?
|
#5
|
||||
|
||||
![]()
Custom Document Properties can contain text, numbers, dates, etc.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#6
|
|||
|
|||
![]() Quote:
"Run-time error '13': Type mismatch" Code:
Case "BidO": .CustomDocumentProperties("BidO").Value = ContentControl.Range.Text |
#7
|
||||
|
||||
![]()
You need to ensure the Custom Document Property type matches your content control's output. A date output as "Tuesday, 5 February" is text, whilst "5/2/2019" is a date. If using a date type, you'll also need code for handling your content control when it displays the placeholder text. For example:
Code:
With ContentControl If .ShowingPlaceholderText = True Then ActiveDocument.CustomDocumentProperties("BidO").Value = "1/1/1900" Else ActiveDocument.CustomDocumentProperties("BidO").Value = ContentControl.Range.Text End If End With
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#8
|
|||
|
|||
![]() Quote:
|
![]() |
Thread Tools | |
Display Modes | |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
EvaMads | Word VBA | 8 | 09-28-2018 02:40 AM |
Add custom doc properties in "Doc properties control" | eazysnatch | Word | 2 | 09-13-2017 08:08 PM |
![]() |
shadowplay | Word | 1 | 07-04-2016 11:36 PM |
![]() |
swissmiss | Drawing and Graphics | 3 | 11-01-2013 05:43 PM |
![]() |
NicBodkin | Word | 8 | 05-05-2011 09:09 AM |