Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

No rules to automatically send and print an email ?

Outlook 2000 Macros

No rules to automatically send and print an email ?

by  toony  Posted    (Edited  )
Thats true, rules in outlook 2000 don't give you the option to Print automatically an email you send but it gives you the option ("rule") to print all the emails you receive.
So here is the Code you have to put inside Outlook Macros : Go in Tools/Macros , Visual Basic Editor and put those codes, the ' followed by a french comment is unnecessary. This is actually 2 Macros, one that will do the Send and print and one that will add a Key Send/Print next to the send button when you write an email, just run the macros and you will be all set. You will have to save the project too:

Public Sub SendWithPrint()
'Performe l'envoie de l'Email
Dim oInsp As Outlook.Inspector
Dim oMail As Outlook.MailItem
Dim oCntr As Object
Dim bNoMailItem As Boolean


If TypeName(Application.ActiveWindow) = "Inspector" Then
Set oInsp = Application.ActiveInspector
If TypeName(oInsp.CurrentItem) <> "MailItem" Then
bNoMailItem = True
End If
Else
bNoMailItem = True
End If
If bNoMailItem Then
MsgBox "Must be in the Email Window you want to send"
Exit Sub
End If
Set oMail = oInsp.CurrentItem
'Le Print Puis l'envoie
oMail.PrintOut
oMail.Send
End Sub

Public Sub AddButton()
'Ajout le bouton "Send/Print" a l'inspector's toolbar
Dim oInsp As Inspector
Dim bDontClose As Boolean
Dim cbb As CommandBarButton
Dim cbbSend2 As CommandBarButton
Dim cbStandard As CommandBar

Set oInsp = Application.CreateItem(olMailItem).GetInspector
On Error Resume Next
'Verifie que le button n'existe pas deja
Set cbStandard = oInsp.CommandBars("Standard")
Set cbb = cbStandard.FindControl(, , "SendWithPrint")
If Not cbb Is Nothing Then
'S'il existe -> rien a faire
Exit Sub
End If
'n'existe pas -> le met apres "Send" item (ID=2617)
Set cbb = cbStandard.FindControl(ID:=2617)
Set cbbSend2 = cbStandard.Controls.Add(msoControlButton, before:=cbb.Index + 1)
cbbSend2.TooltipText = "Send this Email and Print it"
cbbSend2.Caption = "Send/Print"
cbbSend2.Tag = "SendWithPrint"
'assigne la procedure
cbbSend2.OnAction = "SendWithPrint"
'utile pour faire l'action ...
oInsp.Close olDiscard
End Sub
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top