K
kckay
Using Office 2007.
I have a project to enter data in an Excel workbook and then generate
Word document from the Excel data. This is working wonderfully and i
stable.
Unfortunately, I found that the Mergefields in the Word template ar
exempt from the Spell Check tool within Word.
I have performed the Ctrl-A, Review-> Set Language and disable the "D
not check spelling or grammar." This does not work, as the Mergefield
are immediately reset to "Do not check spelling or grammar."
I then inserted a bit of VBA code in the template:
Sub Document_Open()
With ActiveDocument.Range
.NoProofing = False
.LanguageID = wdEnglishUS
End With
End Sub
and saved the template as macro-enabled (.dotm).
The code in Excel to generate the document was modified to access th
new template and to also save the document as .docm using
FileFormat:=wdFormatXMLDocumentMacroEnabled in the SaveAs statement.
Unfortunately, the VBA does not save to the new document, so therefor
will not run when opened.
If I manually enter the VBA code into the document and save it, the cod
will run the next time the document is opened and Spell Check works a
needed.
Question:
1) How do I ensure that the VBA is carried from the .dotm template t
the .docm document
I have a project to enter data in an Excel workbook and then generate
Word document from the Excel data. This is working wonderfully and i
stable.
Unfortunately, I found that the Mergefields in the Word template ar
exempt from the Spell Check tool within Word.
I have performed the Ctrl-A, Review-> Set Language and disable the "D
not check spelling or grammar." This does not work, as the Mergefield
are immediately reset to "Do not check spelling or grammar."
I then inserted a bit of VBA code in the template:
Sub Document_Open()
With ActiveDocument.Range
.NoProofing = False
.LanguageID = wdEnglishUS
End With
End Sub
and saved the template as macro-enabled (.dotm).
The code in Excel to generate the document was modified to access th
new template and to also save the document as .docm using
FileFormat:=wdFormatXMLDocumentMacroEnabled in the SaveAs statement.
Unfortunately, the VBA does not save to the new document, so therefor
will not run when opened.
If I manually enter the VBA code into the document and save it, the cod
will run the next time the document is opened and Spell Check works a
needed.
Question:
1) How do I ensure that the VBA is carried from the .dotm template t
the .docm document