G
Guest
Over the last month I've gotten a crash course in VBA programming in word
that allowed me to create all sorts of neat things.
Now It's Outlook's turn.
I've created a custom form in Outlook that asks for basic contact
information. What I'd like the user to be able to do is press a button and
have it automatically open a Word Document based on a template and fill in
the fields in the document based on what is in the Outlook form.
I put together this code and tried it in Word and it works:
Private Sub NewFormButton_Click()
Documents.Add Template:= _
"C:\Documents and Settings\tallen\Application
Data\Microsoft\Templates\Test.dot" _
, NewTemplate:=False, DocumentType:=0
With ActiveDocument
.FormFields("Company").Result = ClientName
.FormFields("Phone1").Result = ClientPhone
End With
End Sub
Problem is it doesn't work in Outlook. Either I"m not attaching it to the
button right or something about the code is wrong for Outlook, cuz when you
press the button...
nothing happens.
I'm not sure if I've put the code in the right place in the Visual Basic
editor for Outlook (It's under ThisOutlookSession), or if it's the code
itself. Help!
that allowed me to create all sorts of neat things.
Now It's Outlook's turn.
I've created a custom form in Outlook that asks for basic contact
information. What I'd like the user to be able to do is press a button and
have it automatically open a Word Document based on a template and fill in
the fields in the document based on what is in the Outlook form.
I put together this code and tried it in Word and it works:
Private Sub NewFormButton_Click()
Documents.Add Template:= _
"C:\Documents and Settings\tallen\Application
Data\Microsoft\Templates\Test.dot" _
, NewTemplate:=False, DocumentType:=0
With ActiveDocument
.FormFields("Company").Result = ClientName
.FormFields("Phone1").Result = ClientPhone
End With
End Sub
Problem is it doesn't work in Outlook. Either I"m not attaching it to the
button right or something about the code is wrong for Outlook, cuz when you
press the button...
nothing happens.
I'm not sure if I've put the code in the right place in the Visual Basic
editor for Outlook (It's under ThisOutlookSession), or if it's the code
itself. Help!