M
M.L.Srinivas
Hi,
I'm having a peculiar problem when working with the data
(result) of a field in the document.
I'm using customdocumentproperties and these were inserted
as fields in the document.
When the user gives input the fields will get updated. The
problem is with formatting.
I want the data to be displyed in intial caps irrespective
of the format of the data the user had given.
For this I used:
{DOCPROPERTY FirstName \* Caps \* MERGEFORMAT}
Coz, to my knowledge \* Caps displays the data in intial
caps. This is working fine. Now, the problem is with
"George III" sort of names. It is being displayed
as "George Iii".
Similar is the case with "O'Connor" and "McKinney".
How to overcome this? To do this I adopted the logic of
changing the data displayed to my
required format.
Part of my code is:
For Each oStory In DocName.StoryRanges
If oStory.StoryType <>
wdFirstPageHeaderStory Then
oStory.Fields.Update
For Each w In oStory.Fields
cd = Trim(w.code)
PropName = Split(cd, " ")
(1)
If PropName = "FirstName"
Then
Set MyRange = w.Result
MyRange.Text = fname
Set MyRange = Nothing
ElseIf PropName
= "LastName" Then
Set MyRange = w.Result
MyRange.Text = lname
Set MyRange = Nothing
End If
Next
End If
If oStory.StoryType < wdMainTextStory Then
While Not (oStory.NextStoryRange Is
Nothing)
Set oStory = oStory.NextStoryRange
If oStory.StoryType <>
wdFirstPageHeaderStory Then
oStory.Fields.Update
End If
Wend
End If
Next oStory
Set MyRange = Nothing
Set w = Nothing
Set oStory = Nothing
Fname and Lname will have data in required format. This is
also working fine, but when we close
and open the document again the text is again changing
back to "George Iii". And interestingly this
is happening for the fields in header and footer only but
not for fields in general text, they are
retaining the new format,"George III".
Please help. I'm unable to identify the problem and also I
have no solution with me.
Thanks
M.L.Srinivas
I'm having a peculiar problem when working with the data
(result) of a field in the document.
I'm using customdocumentproperties and these were inserted
as fields in the document.
When the user gives input the fields will get updated. The
problem is with formatting.
I want the data to be displyed in intial caps irrespective
of the format of the data the user had given.
For this I used:
{DOCPROPERTY FirstName \* Caps \* MERGEFORMAT}
Coz, to my knowledge \* Caps displays the data in intial
caps. This is working fine. Now, the problem is with
"George III" sort of names. It is being displayed
as "George Iii".
Similar is the case with "O'Connor" and "McKinney".
How to overcome this? To do this I adopted the logic of
changing the data displayed to my
required format.
Part of my code is:
For Each oStory In DocName.StoryRanges
If oStory.StoryType <>
wdFirstPageHeaderStory Then
oStory.Fields.Update
For Each w In oStory.Fields
cd = Trim(w.code)
PropName = Split(cd, " ")
(1)
If PropName = "FirstName"
Then
Set MyRange = w.Result
MyRange.Text = fname
Set MyRange = Nothing
ElseIf PropName
= "LastName" Then
Set MyRange = w.Result
MyRange.Text = lname
Set MyRange = Nothing
End If
Next
End If
If oStory.StoryType < wdMainTextStory Then
While Not (oStory.NextStoryRange Is
Nothing)
Set oStory = oStory.NextStoryRange
If oStory.StoryType <>
wdFirstPageHeaderStory Then
oStory.Fields.Update
End If
Wend
End If
Next oStory
Set MyRange = Nothing
Set w = Nothing
Set oStory = Nothing
Fname and Lname will have data in required format. This is
also working fine, but when we close
and open the document again the text is again changing
back to "George Iii". And interestingly this
is happening for the fields in header and footer only but
not for fields in general text, they are
retaining the new format,"George III".
Please help. I'm unable to identify the problem and also I
have no solution with me.
Thanks
M.L.Srinivas