×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Microsoft: Office FAQ

Outlook 2000 Macros

No rules to automatically send and print an email ? by toony
Posted: 28 May 01

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

Back to Microsoft: Office FAQ Index
Back to Microsoft: Office Forum

My Archive

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close