Outlook - managing out of office outlook

Asked By Morris dany
06-Nov-11 05:04 PM

out of office outlook VBA

Asked By Morris dany
06-Nov-11 04:28 PM
I am looking for a vba code  that allows my new emails  to be forwarded to an other person  when I am out of office. I have Outlook 2003.
  Riley K replied to Morris dany
06-Nov-11 09:33 PM


Here’s an example of a simple macro that sends an Outlook email.


Sub sl()
    Dim olApp As Outlook.Application
    Dim objMail As Outlook.MailItem
    Set olApp = Outlook.Application
    Set objMail = olApp.CreateItem(olMailItem)
    objMail.BodyFormat = olFormatPlain
    objMail.Subject = "Hi buddy"
    objMail.Body = "Whats up" + Chr(13) + Chr(10) + "Greg"
    objMail.To = "goofus@doofus.com"
    objMail.Send
End Sub


Refer this link

http://support.microsoft.com/kb/161088


Regards












  [ Kirtan ] replied to Morris dany
06-Nov-11 11:42 PM
Untitled document
Public myFolder2 As Outlook.MAPIFolder
Public Sub forward_after18()
  Dim myOlapp As Outlook.Application
  Dim myNameSpace As Outlook.NameSpace
  Dim myFolder As Outlook.MAPIFolder
 
  Dim avTime() As String
  Dim rTime As Date
  Dim vTime1 As Date
  Dim vTime2 As Date
  Dim vTime3 As Date
  Dim vTime4 As Date
 
  ReDim Preserve avTime(2)
 
  myOlapp = CreateObject("Outlook.Application")
  myNameSpace = myOlapp.GetNamespace("MAPI")
  'This is the default inbox folder
  myFolder = myNameSpace.GetDefaultFolder(olFolderInbox)
  'This is the folder that's going to be processed.
  'If you want inboxfolder, just put a ' in front of next line
  myFolder2 = myFolder.Folders("After_18")
  For Each myItem In myFolder.Items
    'processes all unread items in mailbox you specified
    If myItem.UnRead = True Then
      avTime = Split(CStr(myItem.ReceivedTime), " ")
      rTime = avTime(1)
      vTime1 = TimeSerial(18, 0, 0) : vTime2 = TimeSerial(23, 59, 59)
      vTime3 = TimeSerial(0, 0, 0) : vTime4 = TimeSerial(8, 0, 0)
      If rTime >= vTime1 And rTime < vTime2 Or _
      rTime >= vTime3 And rTime <= vTime4 Then
        myItem.Move(myFolder2)
        'Call Mail_with_CDO
      End If
    End If
  Next myItem
  Call Mail_with_Redemption()
End Sub
Sub Mail_with_Redemption()
  'You must first install a dll, called redemption.dll
  'You have to setup a reference to this library in outlook.
  Dim Session As Object
  Dim mail As Object
  For Each myItem In myFolder2.Items
    'processes all unread items in mailbox you specified
    If myItem.UnRead = True Then
      Session = CreateObject("Redemption.RDOSession")
      Session.Logon()
      mail = Session.GetDefaultFolder(olFolderOutbox).Items.Add("IPM.Note")
      mail.Subject = myItem.Subject
      mail.Body = "Automatic forwarding after 18.00 - before 8.00"
      mail.Recipients.Add("adress@provider")
      mail.Attachments.Add(myItem)
      myItem.UnRead = False
      mail.Send()
    End If
  Next myItem
End Sub
 
  Morris dany replied to [ Kirtan ]
07-Nov-11 09:06 PM



How can I setup "redemption.dll" by vba code  like

 .........refrences.add (".........redemption.dll")

best regards

  [ Kirtan ] replied to Morris dany
07-Nov-11 10:24 PM
you can add Reference to Redemption.dll When you write VBA Code

Click >> Tools Menu >> References >> "Browse to DLL File"

Redemption DLL is COM visible

Thanks
  [ Kirtan ] replied to Morris dany
07-Nov-11 10:27 PM
if you want to add Reference to Library Via Code here is code for it

Untitled document
Sub AddReference()
  'Macro purpose:  To add a reference to the project using the GUID for the
  'reference library
 
  Dim strGUID As String, theRef As Object, i As Long
 
  'Update the GUID you need below.
  strGUID = "{00020905-0000-0000-C000-000000000046}"
 
  'Set to continue in case of error
  On Error Resume Next
 
  'Remove any missing references
  For i = ThisWorkbook.VBProject.References.Count To 1 Step -1
    theRef = ThisWorkbook.VBProject.References.Item(i)
    If theRef.isbroken = True Then
      ThisWorkbook.VBProject.References.Remove(theRef)
    End If
  Next i
 
  'Clear any errors so that error trapping for GUID additions can be evaluated
  Err.Clear()
 
  'Add the reference
  ThisWorkbook.VBProject.References.AddFromGuid( _
  GUID:=strGUID, Major:=1, Minor:=0)
 
  'If an error was encountered, inform the user
  Select Case Err.Number
    Case Is = 32813
      'Reference already in use.  No action necessary
    Case Is = vbNullString
      'Reference added without issue
    Case Else
      'An unknown error was encountered, so alert the user
      MsgBox("A problem was encountered trying to" & vbNewLine _
      & "add or remove a reference in this file" & vbNewLine & "Please check the " _
      & "references in your VBA project!", vbCritical + vbOKOnly, "Error!")
  End Select
  On Error GoTo 0
End Sub
 
Using it :
Update the strGUID to the GUID of the library you need
  Morris dany replied to [ Kirtan ]
11-Dec-11 06:33 AM
  
 I have a vba code with itemsend event . It works fine from outlook .

  But When I  send an email from Word   ( with or without attachment )  the  itemsend event doesn't fire.


Any help

Regards

Create New Account
help
Terminal Server and Outlook 2003 Outlook Outlook 2003 on our W2K terminal server gives the following error. . "Outlook failed to start correctly last time." Then it offers to start outlook in safe mode. If you say no then Outlook starts and work okay. If you
outlook 2003 error Outlook our outllook 2003 suddenly received message with bank message body , only show sender details and subject., need sender re-send again . The sender using outlook 2003 Eng sending , pls advice how to solve out this error. Outlook Discussions Outlook 2003 (1) Access 2003 (1) Outlook (1) Completewe (1) Newsletter (1) Dailytips
Can't start Outlook 2003 Outlook Outlook 2003 was working fine a week ago. Now when I try to open it I get the following error message: The set of folders could not be opened. The server is not available. Contact your administrator if this condition persists." I have reinstalled Office 2003 and Outlook 2003 and still get the same error message. I am running the software on my
outlook 2003 Outlook outlook 2003 is MIA I did a detect and repair in excel 03 and after that outlook gives me error message; the operation failed due to an installation problem. Restart outlook and try again. If problem persists, please reinstall. Well my cd from original purchase will
Outlook 2003 Outlook Outlook 2003 stopped sending emails out. I can recieve reply, but not send a new email. - - Emmaf Outlook General Discussions Outlook 2003 (1) SMTP (1) Crashproof (1) Ramblings (1) Knyshov (1) Usenet.shtml (1) Firewall (1) Pretense