B
Bill Agee
I have a Word document that contains the following:
Date
{ DOCVARIABLE "AttyFirm" }
Dear Mr. Lewis:
etc
and an Access program that contains the following code:
Private Sub cmdDocVariable_Click()
Dim wAttyFirm As String
Dim WordApp As Word.Application
Dim WordDoc As Word.Document
wAttyFirm = "Smith, Jones and Johnson"
Set WordApp = New Word.Application
Set WordDoc = New Word.Document
Set WordDoc = WordApp.Documents.Add("C:\Documents and
Settings\Administrator\Application
Data\Microsoft\Templates\DTVLettertest.dot")
WordDoc.Variables("AttyFirm").Value = [wAttyFirm]
WordDoc.Fields.Update
WordApp.Visible = True
Debug.Print wAttyFirm ' Smith, Jones and Johnson
WordDoc.SaveAs filename ' where filename is a path and filename
End Sub
Absolutely nothing happens. Is there something obvious that is wrong?
Date
{ DOCVARIABLE "AttyFirm" }
Dear Mr. Lewis:
etc
and an Access program that contains the following code:
Private Sub cmdDocVariable_Click()
Dim wAttyFirm As String
Dim WordApp As Word.Application
Dim WordDoc As Word.Document
wAttyFirm = "Smith, Jones and Johnson"
Set WordApp = New Word.Application
Set WordDoc = New Word.Document
Set WordDoc = WordApp.Documents.Add("C:\Documents and
Settings\Administrator\Application
Data\Microsoft\Templates\DTVLettertest.dot")
WordDoc.Variables("AttyFirm").Value = [wAttyFirm]
WordDoc.Fields.Update
WordApp.Visible = True
Debug.Print wAttyFirm ' Smith, Jones and Johnson
WordDoc.SaveAs filename ' where filename is a path and filename
End Sub
Absolutely nothing happens. Is there something obvious that is wrong?