Consulting

Results 1 to 5 of 5

Thread: auto subject help needed.

  1. #1

    auto subject help needed.

    I have two separate macros that I would like to join together but have no idea how to do it.

    The first is to auto populate the date and name before the subject text. The second one when you click on send comes up with a box asking if you would like to send as encrypted, if yes is selected it puts encrypt at the start of the subject. if no is clicked then still have the date at the start.



    Private Sub Application_ItemSend(ByVal ITEM As Object, Cancel As Boolean)

    If Left(ITEM.Subject, 4) = Format(Now(), "yyyymm") Or Left(ITEM.Subject, 3) = "FW:" Or Left(ITEM.Subject, 3) = "RE:" Then
    Else
    ITEM.Subject = Format(Now(), "yyyymmdd-") & “ME" & Replace(ITEM.Subject, " ", "_")
    End If

    End Sub





    Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
    dim msg as string

    msg =
    Select Case MsgBox("Would you like to Encrypt this message?", vbYesNoCancel + vbQuestion + vbMsgBoxSetForeground, Item.Subject)


    Case Is = vbYes
    Set olkMsg = Outlook.Application.ActiveInspector.CurrentItem
    olkMsg.Subject = "encrypt" & olkMsg.Subject
    Set olkMsg = Nothing

    Case Is = vbNo
    Cancel = False

    Case Is = vbCancel
    Cancel = True

    End Select

    End Sub
    Last edited by martindixon; 04-01-2014 at 11:28 AM.

  2. #2
    try
    Private Sub Application_ItemSend(ByVal ITEM As Object, Cancel As Boolean)
     
    If Left(ITEM.Subject, 4) = Format(Now(), "yyyymm") Or Left(ITEM.Subject, 3) = "FW:" Or Left(ITEM.Subject, 3) = "RE:" Then
    Else
    ITEM.Subject = Format(Now(), "yyyymmdd-") & “ME" &  Replace(ITEM.Subject, " ", "_")                                                                         
    End If
     Select Case MsgBox("Would you like to Encrypt this message?", vbYesNoCancel + vbQuestion + vbMsgBoxSetForeground, Item.Subject)
       Case Is = vbYes
         item.Subject = "encrypt" & olkMsg.Subject
      ' Case Is = vbNo
        ' Cancel = False  not required
       Case Is = vbCancel
         Cancel = True
    End Select
    
    End Sub

  3. #3
    Thank you

  4. #4
    I'm getting a syntax error on

    ITEM.Subject = Format(Now(), "yyyymmdd-") & “ME" & Replace(ITEM.Subject, " ", "_")

    any ideas?

  5. #5
    i tested
    ITEM.Subject = Format(Now(), "yyyymmdd-") & "ME" & Replace(ITEM.Subject, " ", "_")
    no error

    watch for invalid " characters when pasting

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •