creating a template in word with access

C

castle

I have created a template in word copied it and pasted it into access vba
procedure. A button print will be pressed in the form and the details will
automatically print of the name and address entered into text boxes on the
form.

The printout is working, but i am having some trouble putting in the
txtboxes in the code so it will print the name in correct way ie

it should print; Dear Mr Jones,

The dear is in the templae always but mr and jones comes from the textboxes
in the form.

this line will work

.TypeParagraph
.TypeText Form_Template.txtSurname
.TypeParagraph

but having trouble making it as mensioned above

.TypeText "Dear & " " & Form_Template.lstTitle & " " &
Form_Template.txtSurname & ","

I have'nt tried printing that out yet as the line shows red (telling me it
is wrong), i must be missing a comma or ampersand somewhere.
 
G

Graham Mayor

..TypeText "Dear & " " & Form_Template.lstTitle & " " & _
Form_Template.txtSurname & ","

should presumably read

..TypeText "Dear " & Form_Template.lstTitle & " " & _
Form_Template.txtSurname & ","

or even

..TypeText Form_Template.lstTitle & " " & _
Form_Template.txtSurname & ","

if Dear is already present in the document?

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
Top