Inserting Field(CustomDocProperties) from VB

M

M.L.Srinivas

I added CustomDocumentProperty to a doc thru Vb by using

Set DP = WordDoc.CustomDocumentProperties.Add
(Name:="JobDate", LinkToContent:=False,
Type:=msoPropertyTypeDate, Value:="01-Jan-2000")

It's a date field. And I want to place this prop at the
point of insertion from Vb. I'm using the following code:

Selection.Collapse Direction:=wdCollapseStart
Set myField = wordapp.ActiveDocument.Fields.Add
(Range:=Selection.Range, _
Type:=wdFieldDate, Text:="JobDate")

It's working fine..but i want multiple formats as dd-MM-
YY,dd-MMM-yyyy etc.

How can i do that, i tried in vain with following code:

Selection.Collapse Direction:=wdCollapseStart
Set myField = wordapp.ActiveDocument.Fields.Add
(Range:=Selection.Range, _
Type:=wdFieldDate, Text:="JobId \@ 'dd-MM-YY'")

Please help me.. i have done it thru this method for
strings.

Thanks in advance

M.L.Srinivas
 
J

JGM

Hi M.L.

Try this:
Set myField = WordDoc.Fields.Add(Range:=Selection.Range, _
Type:=wdFieldDate, Text:="JobDate \@ ""dd-MM-yy"" ")

HTH
Cheers!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top