The issue is that the footer docvariable is displaying correctly when you
save and print, however if you save again, close the document, open the
document and print again, I get funny characters in the docvariable, e.g.
Ұx㊡䰜㊸ۿۿ㌀ۖĀ̏홪Ę蔀
My code to insert info from the user form is:
Private Sub cmdOK_Click()
strDate = Format(Now, "d MMMM yyyy")
strTitle = frmConfAgenda.txtTitle
strcommname = frmConfAgenda.CboCommittee
strrepoff = frmConfAgenda.txtRepOff
strreptitle = frmConfAgenda.TxtRepTitle
strconf = frmConfAgenda.txtConfidential
strmeetdate = FormatDateTime(frmConfAgenda.calMeetingDate.Value, vbLongDate)
strmeetdate2 = Format(frmConfAgenda.calMeetingDate.Value, "d MMMM yyyy")
strreason = frmConfAgenda.TxtReason
strcul = frmConfAgenda.TxtCultural
streco = frmConfAgenda.TxtEconomic
strenv = frmConfAgenda.TxtEnvironment
strsoc = frmConfAgenda.TxtSocial
'Populate the document
ActiveDocument.Variables("mission").Value = strreason
ActiveDocument.Variables("cultural").Value = strcul
ActiveDocument.Variables("eco").Value = streco
ActiveDocument.Variables("env").Value = strenv
ActiveDocument.Variables("social").Value = strsoc
ActiveDocument.Variables("date").Value = strDate
ActiveDocument.Variables("Title").Value = strTitle
ActiveDocument.Variables("Name").Value = strcommname
ActiveDocument.Variables("MeetDate").Value = strmeetdate
ActiveDocument.Variables("MeetDate2").Value = strmeetdate2
ActiveDocument.Variables("RepOff").Value = strrepoff
ActiveDocument.Variables("RepTitle").Value = "(" & strreptitle & ")"
ActiveDocument.Variables("Confidential").Value = strconf
'Update fields
ActiveDocument.Fields.Update
Dim oSec As Section
For Each oSec In ActiveDocument.Sections
With oSec
.Headers(wdHeaderFooterPrimary).Range.Fields.Update
.Footers(wdHeaderFooterPrimary).Range.Fields.Update
End With
Next oSec
'Go to beginning of document
Selection.HomeKey Unit:=wdStory
Selection.NextField.Select
Selection.Fields.Update
Selection.HomeKey Unit:=wdStory
ActiveDocument.ActiveWindow.View.Type = wdPrintView
End
End Sub
The fields I have in the footer are:
{ DOCVARIABLE Name \* MERGEFORMAT }
{ PAGE }
{ DOCVARIABLE MeetDate2 \* MERGEFORMAT }
{ FILENAME \p \* MERGEFORMAT }
The page and filename fields are okay, it's just the docvariables.
I'm also having the same issue with docvariable fields in the body of a
letter template. The funny characters only appear when they do a mail merge
based on the letter template, and it's only started happening since the
upgrade to Word 2007.
Any help appreciated!!!!!!!!!!! :)
Saving documents in Word 97-2003 format, rather than in *docx format,
however seems to avoid the problem.
--
Hope this helps
Doug Robbins - Word MVP
Please reply only to the newsgroups unless you wish to avail yourself of my
services on a paid, professional basis.
"Lee Kiwiflame" <LeeKiw...@discussions.microsoft.com> wrote in message
news:62080B70-F2DC-46B8...@microsoft.com...
>I have many templates that have vba which were created in Word 2003.
> However, since we upgraded to Word 2007, all templates that have a
> docvariable field in the footer are now breaking.
>
> The issue is that the footer docvariable is displaying correctly when you
> save and print, however if you save again, close the document, open the
> document and print again, I get funny characters in the docvariable, e.g.
> ?x???????????A??E?
I noticed that if I save as 97-2003 format then there is no issue, however,
that is not the ideal resolution as we can't save them with that format
forever :)
I just thought that there might be a website, blog or forum that identified
the difference of how Word 2003 and Word 2007 works with VBA.
This issue is really strange... :(
--
Hope this helps
Doug Robbins - Word MVP
Please reply only to the newsgroups unless you wish to avail yourself of my
services on a paid, professional basis.
"Lee Kiwiflame" <LeeKiw...@discussions.microsoft.com> wrote in message
news:C67E10A4-9EED-427C...@microsoft.com...
I am quite sure that the problem is the one discussed in e.g. this thread:
http://groups.google.com/group/microsoft.public.word.docmanagement/browse_thread/thread/8505d59974f1c804/49bbf1ef19ca11a7?q=word+variable+hotfix+2007
I have experienced the problem myself and found that it was solved by
installing the Hotfix that can be downloaded from here:
http://support.microsoft.com/default.aspx?scid=kb;en-us;970942&sd=rss&spid=11377
I have not noticed any problems after installing the Hotfix.
As Doug said, the problem does not occur when saving in 97-2003 format.
Note that the variables that have already been ruined will not be cured by
installing the Hotfix. They need to be repaired via VBA.
--
Best regards
Lene Fredborg
Microsoft MVP (Word)
DocTools - Denmark
http://www.thedoctools.com
"Lee Kiwiflame" <LeeKiw...@discussions.microsoft.com> skrev i en
meddelelse news:62080B70-F2DC-46B8...@microsoft.com...
>I have many templates that have vba which were created in Word 2003.
> However, since we upgraded to Word 2007, all templates that have a
> docvariable field in the footer are now breaking.
>
> The issue is that the footer docvariable is displaying correctly when you
> save and print, however if you save again, close the document, open the
> document and print again, I get funny characters in the docvariable, e.g.
> ?x???????????A??E?
--
Hope this helps.
Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.
Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
"Lene Fredborg" <l...@thedoctools.com> wrote in message
news:%23TN4qEM...@TK2MSFTNGP04.phx.gbl...