#1   Report Post  
Posted to microsoft.public.word.docmanagement
Catherine Catherine is offline
external usenet poster
 
Posts: 48
Default Quick Part

When i add a new custom field E.g {DOCPROPERTY "Transaction Comments" }to
my document (Type: Text) there is a restriction to 255 characters.
Is there any way to increase this? Or is this a M/S word restriction that
cannot be changed?
  #2   Report Post  
Posted to microsoft.public.word.docmanagement
Jay Freedman Jay Freedman is offline
external usenet poster
 
Posts: 9,854
Default Quick Part

Catherine wrote:
When i add a new custom field E.g {DOCPROPERTY "Transaction
Comments" }to my document (Type: Text) there is a restriction to 255
characters.
Is there any way to increase this? Or is this a M/S word restriction
that cannot be changed?


It is a restriction that can't be changed. I didn't find any official
documentation of this, but the result of the following macro makes it clear
that Word truncates the input to 255 characters:

Sub x()
Dim mystr As String
Dim myCP As DocumentProperty
mystr = String(260, "A")
ActiveDocument.CustomDocumentProperties.Add _
Name:="test1", LinkToContent:=False, _
Type:=msoPropertyTypeString, _
Value:=mystr

MsgBox Len(ActiveDocument.CustomDocumentProperties("test1 ").Value)
End Sub

However, there is no such restriction on document *variables*, as the result
of this similar macro shows:

Sub y()
Dim mystr As String
Dim myVar As Variable
mystr = String(500, "A")
ActiveDocument.Variables.Add _
Name:="test1", Value:=mystr

MsgBox Len(ActiveDocument.Variables("test1").Value)
End Sub

In the document, you can display the value of the variable with a field
{DOCVARIABLE test1}.

The two main differences between custom document properties and document
variables are (a) all document variables are strings, and (b) there is no
dialog for setting document variables, so they must be set through a
macro -- this may be a drawback or a benefit, depending on whether you want
to allow users to change the value.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.


  #3   Report Post  
Posted to microsoft.public.word.docmanagement
Jay Freedman Jay Freedman is offline
external usenet poster
 
Posts: 9,854
Default Quick Part

Catherine wrote:
When i add a new custom field E.g {DOCPROPERTY "Transaction
Comments" }to my document (Type: Text) there is a restriction to 255
characters.
Is there any way to increase this? Or is this a M/S word restriction
that cannot be changed?


It is a restriction that can't be changed. I didn't find any official
documentation of this, but the result of the following macro makes it clear
that Word truncates the input to 255 characters:

Sub x()
Dim mystr As String
Dim myCP As DocumentProperty
mystr = String(260, "A")
ActiveDocument.CustomDocumentProperties.Add _
Name:="test1", LinkToContent:=False, _
Type:=msoPropertyTypeString, _
Value:=mystr

MsgBox Len(ActiveDocument.CustomDocumentProperties("test1 ").Value)
End Sub

However, there is no such restriction on document *variables*, as the result
of this similar macro shows:

Sub y()
Dim mystr As String
Dim myVar As Variable
mystr = String(500, "A")
ActiveDocument.Variables.Add _
Name:="test1", Value:=mystr

MsgBox Len(ActiveDocument.Variables("test1").Value)
End Sub

In the document, you can display the value of the variable with a field
{DOCVARIABLE test1}.

The two main differences between custom document properties and document
variables are (a) all document variables are strings, and (b) there is no
dialog for setting document variables, so they must be set through a
macro -- this may be a drawback or a benefit, depending on whether you want
to allow users to change the value.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.


  #4   Report Post  
Posted to microsoft.public.word.docmanagement
Catherine Catherine is offline
external usenet poster
 
Posts: 48
Default Quick Part

Jay,

Many thanks for your prompt help.

Catherine

"Jay Freedman" wrote:

Catherine wrote:
When i add a new custom field E.g {DOCPROPERTY "Transaction
Comments" }to my document (Type: Text) there is a restriction to 255
characters.
Is there any way to increase this? Or is this a M/S word restriction
that cannot be changed?


It is a restriction that can't be changed. I didn't find any official
documentation of this, but the result of the following macro makes it clear
that Word truncates the input to 255 characters:

Sub x()
Dim mystr As String
Dim myCP As DocumentProperty
mystr = String(260, "A")
ActiveDocument.CustomDocumentProperties.Add _
Name:="test1", LinkToContent:=False, _
Type:=msoPropertyTypeString, _
Value:=mystr

MsgBox Len(ActiveDocument.CustomDocumentProperties("test1 ").Value)
End Sub

However, there is no such restriction on document *variables*, as the result
of this similar macro shows:

Sub y()
Dim mystr As String
Dim myVar As Variable
mystr = String(500, "A")
ActiveDocument.Variables.Add _
Name:="test1", Value:=mystr

MsgBox Len(ActiveDocument.Variables("test1").Value)
End Sub

In the document, you can display the value of the variable with a field
{DOCVARIABLE test1}.

The two main differences between custom document properties and document
variables are (a) all document variables are strings, and (b) there is no
dialog for setting document variables, so they must be set through a
macro -- this may be a drawback or a benefit, depending on whether you want
to allow users to change the value.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.


.

  #5   Report Post  
Posted to microsoft.public.word.docmanagement
Catherine Catherine is offline
external usenet poster
 
Posts: 48
Default Quick Part

Jay,

Many thanks for your prompt help.

Catherine

"Jay Freedman" wrote:

Catherine wrote:
When i add a new custom field E.g {DOCPROPERTY "Transaction
Comments" }to my document (Type: Text) there is a restriction to 255
characters.
Is there any way to increase this? Or is this a M/S word restriction
that cannot be changed?


It is a restriction that can't be changed. I didn't find any official
documentation of this, but the result of the following macro makes it clear
that Word truncates the input to 255 characters:

Sub x()
Dim mystr As String
Dim myCP As DocumentProperty
mystr = String(260, "A")
ActiveDocument.CustomDocumentProperties.Add _
Name:="test1", LinkToContent:=False, _
Type:=msoPropertyTypeString, _
Value:=mystr

MsgBox Len(ActiveDocument.CustomDocumentProperties("test1 ").Value)
End Sub

However, there is no such restriction on document *variables*, as the result
of this similar macro shows:

Sub y()
Dim mystr As String
Dim myVar As Variable
mystr = String(500, "A")
ActiveDocument.Variables.Add _
Name:="test1", Value:=mystr

MsgBox Len(ActiveDocument.Variables("test1").Value)
End Sub

In the document, you can display the value of the variable with a field
{DOCVARIABLE test1}.

The two main differences between custom document properties and document
variables are (a) all document variables are strings, and (b) there is no
dialog for setting document variables, so they must be set through a
macro -- this may be a drawback or a benefit, depending on whether you want
to allow users to change the value.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.


.

Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
New Header/Footer Quick Part? Susanne Mohn Microsoft Word Help 6 October 4th 09 06:28 AM
quick part entry Dana1 Microsoft Word Help 5 June 14th 08 01:17 AM
Quick Part - Fill in (help) Jag Microsoft Word Help 0 September 17th 07 08:00 PM
How do you edit a Quick Part entry? Dee Meyerink Microsoft Word Help 2 March 29th 07 03:26 PM
Can't delete a quick part David Kirk Microsoft Word Help 3 January 7th 07 01:51 PM


All times are GMT +1. The time now is 09:05 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"