• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Search results

  1. niton

    Save and rename outlook email attachments to include domain name & date received

    You can extract somewhat useful information out of SenderEmailAddress. Public Sub SaveAttachmentsToDisk(MItem As mailItem) Dim oAttachment As attachment Dim sSaveFolder As String Dim sndrEmailAdd As String Dim sndrEmailRight As String Dim sndrEmailPreDot As String...
  2. niton

    Outlook reverse categories

    You could set all the categories at once: Private Sub SetCategories() Dim myItem As Object Dim strCat As String Set myItem = ActiveInspector.currentItem If myItem.Class = olMail Then strCat = "Estimate, client, someone waiting, Now" myItem.Categories = strCat myItem.Save End If...
  3. niton

    Macro to add date/time stamp to subject

    You forgot the subject. If Left(aItem.subject, 8) = Left(aItem.ReceivedTime, 8) Then GoTo Skip To remove duplicate prefixes: Option Explicit Sub PrefixReceivedTime_RemoveDuplicate() Dim aItem As Object Dim aMail As mailItem Dim aSubject As String Dim mailFldr As folder...
  4. niton

    Autosave Attachment and Rename

    objAtt does not have a SenderName property. Use itm instead.
  5. niton

    Answered street address fields contain 0A0D

    Assuming your text is now on a single line, after you make a backup you can try replacing the 0A0D in the text. Private Sub ContactFolderItems_replace_0A0D() Dim cFolder As folder Dim cItem As Object Dim i As Long ' 0A = Line feed ' 0D = Carriage return Set cFolder =...
  6. niton

    Removing Recipients from an automatic response

    You can filter the recipients by type For Each recip In item.Recipients If Not recip.Type = olBCC Then If Not recip = "xxx@domain.com" + "yyy@domain.com" Then newMsg.Recipients.Add recip End If...
  7. niton

    Received mail as part of DL, need to auto-CC the same when replying

    The originator of the mail could use a template where Reply is disabled. Follow these instructions for the Reply button. Disable “Reply to All” For Email Recipients If Reply is needed then the receiver can delete the entry in To and enter specific addresses.
  8. niton

    Auto scroll to specific folder in Folder Pane

    I found this code will autoscroll except sometimes the Inbox. Sub Folder_Inbox() ActiveExplorer.ShowPane olFolderList, True Set ActiveExplorer.CurrentFolder = Session.GetDefaultFolder(olFolderInbox) End Sub
  9. niton


    This is why I try to use down count loops only as I tend to forget about the index problem when moving or deleting. For Each is simple to use but it is the same as For I = 1 to count. Option Explicit Sub MoveToFiled() ' Do not put at the start. Use for specific purpose ' On Error...
  10. niton

    Removing illegal characters

    If you just want results rather than the technical reason Mid does not delete try this. Private Sub remove_illegal() ' Clean out characters from Subject which are not permitted in a file name ' Loop in reverse if deleting Dim strMsgSubj As String Dim intC As Long strMsgSubj = "Hello...
  11. niton

    Change From address while sending a new mail

    Try this: Private Sub Application_ItemSend(ByVal item As Object, Cancel As Boolean) Dim objItem As MailItem If TypeOf item Is MailItem Then Set objItem = item.Copy Set objRecip = objItem.Recipients.Add(item.SentOnBehalfOfName) objRecip.Type = olBCC objRecip.Resolve...
  12. niton

    Help with VBA please!

    Pass the item in a public variable. In a regular module Public sentMailNewMail as Mailitem Private Sub olSentItems_ItemAdd(ByVal Item As Object) If TypeOf Item Is MailItem Then Set sentMailNewMail = Item UserForm1.Show End If End Sub Userform 1 Private Sub CommandButton1_Click()...
  13. niton

    Help with VBA please!

    With ItemSend you must have a mailitem open. If you only open the userform from ItemSend this should pick up the item being sent. Public Sub SaveSent2_test() Dim strPath As String On Error Resume Next strPath = UserForm3.TextBox1.Value On Error GoTo 0 If strPath = "" Then...
  14. niton

    VBA Code to Restart Outlook on error

    If you temporarily remove Private from Private Sub Application_Startup you can put "ThisOutlookSession.Application_Startup" on the Quick Access Toolbar or a Ribbon. You can put Private back afterwards.