VB email document code

S

shawneedsm

I have the following code that I am trying to use. The debugger stops at the
..subject line:
*********************
Private Sub SendTo_Click()

Dim Msg, Style, Title, Response
Dim Subject, AddRecipient, Delivery As Object

Msg = "Request has been forwarded!"
Style = vbOKOnly
Title = "Routing Confirmation"

' disable CommandButton
SendTo.Enabled = False

' Route the workbook
ActiveDocument.HasRoutingSlip = True
With ActiveDocument.RoutingSlip
.Subject = "Report Leak"
.AddRecipient "(e-mail address removed)"
.Delivery = wdAllAtOnce
End With
ActiveDocument.Route

' Message box gives confirmation that document was routed
Response = MsgBox(Msg, Style, Title)

' Enable CommandButton
SendTo.Enabled = True

' close the workbook without saving changes
ActiveDocument.Close (wdDoNotSaveChanges)
End Sub
*************
I always get the following errors:
first one window with "General mail failure. Close Microsoft Office Word,
restart the mail system, and try again." and a second window after that with
"Run time error '91': object variable or with block variable not set."

What am I doing wrong?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top