here is the scenario I am wanting to complete:
I have a form that I fill out for each client that walks through the door. It is a checklist for the accountant that is going to be helping them. What I would like to do is be able to select the client in Business Contact Manager 2013, have a macro run to print out the form populated with that client's name, id # address etc. I would also like to have a buttom in the ribbon to automate this.
Here is the script that I have. Whenever I try to run it, I get an error message that it can't find my form, but I know the location I have is right. So maybe it's the script I have before it? Could someone please give me some suggestions? Also, if I am going about this totally wrong, please let me know.
Public Sub SendAddressToWord()
'Dim oContact
If TypeName(ActiveExplorer.Selection.Item(1)) = "ContactItem" Then
Set oContact = ActiveExplorer.Selection.Item(1)
' Declare the variable.
Dim oWord As Word.Application
' Set the variable (runs new instance of Word).
Set oWord = CreateObject("Word.Application")
oWord.Documents.Add Template:="C:\Users\Beth\AppData\Roaming\Microsoft\Templates\PreparerChecklist.dotm"
With oWord
' Find the bookmark, insert an Outlook field
.Selection.GoTo What:=wdGoToBookmark, Name:="FullName"
.Selection.TypeText Text:=oContact.FullName
.Selection.GoTo What:=wdGoToBookmark, Name:="ClientId"
.Selection.TypeText Text:=oContact.UserProperties("ClientId")
.Selection.GoTo What:=wdGoToBookmark, Name:="Address1"
.Selection.TypeText Text:=oContact.Address1
.Selection.GoTo What:=wdGoToBookmark, Name:="City1"
.Selection.TypeText Text:=oContact.City1
.Selection.GoTo What:=wdGoToBookmark, Name:="State1"
.Selection.TypeText Text:=oContact.State1
.Selection.GoTo What:=wdGoToBookmark, Name:="ZipCode"
.Selection.TypeText Text:=oContact.ZipCode
.Selection.GoTo What:=wdGoToBookmark, Name:="Email2"
.Selection.TypeText Text:=oContact.Email2
.Selection.GoTo What:=wdGoToBookmark, Name:="PrimaryPhone"
.Selection.TypeText Text:=oContact.PrimaryPhone
' Show the Word document
.Visible = True
End With
' Clear the variable from memory.
Set oWord = Nothing
Else
MsgBox "Sorry, you need to select a contact"
End If
End Sub