Search results

  1. niton

    Return Highest Level Email Folder

    Option Explicit Private Sub highest_folder() Dim obj As Object Dim F As Folder Dim nextF As Folder Set obj = ActiveWindow If TypeOf obj Is Inspector Then Set obj = obj.currentItem Else Set obj = obj.Selection(1) End If Set F = obj.Parent...
  2. niton

    auto send email when meeting closes from a shared calendar only

    How to add a shared mailbox as additional account in Outlook Reminders for an added shared account pop up as though they were my own appointments. I tested and the reminder triggers the code and mail is deferred to Item.End
  3. niton

    "invalid or unqualified reference" on code that should work

    Runtime Error 91 - Object variable not set. With the assumption that the error occurs on the line objNewMailItems_ItemAdd ActiveInspector.CurrentItem the object is an open mailitem "ActiveInspector.CurrentItem ". Did you open a mailitem?
  4. niton

    "invalid or unqualified reference" on code that should work

    Whether in Excel or Outlook you cannot run code that requires a parameter as standalone. You can drag a mailitem into the folder or add a mailitem to the folder with other VBA code or for testing, except for the adding part, you can pass a mailitem like this: Private Sub test() ' First open a...
  5. niton

    Vba to monitor time to respond to emails using a shared mailbox

    There is no code fix that I can see. The code works in a profile where I added an account Add an email account to Outlook . The code generates an error in a profile where I added a mailbox How to Add Additional Mailbox to Outlook 2016
  6. niton

    Vba to monitor time to respond to emails using a shared mailbox

    I generated an error where there was a shared mailbox. If you did not use File | Add Account, try this with new profile. There was no error there.
  7. niton

    Vba to monitor time to respond to emails using a shared mailbox

    On Error Resume Next = Fail mysteriously when I do not know how to use it. If you remove the two instances of On Error Resume Next when you run the code on the Inbox you will see any errors that were being hidden. Once fixed you would run the code on the shared mailbox and see any different...
  8. niton

    Run macro on existing appointment when it changes

    ItemChange will run on the one item that triggers it unless you code it to process other items. Without code it is impossible to determine the issue. You do not have to "suspect it is running the macro in a loop on all items." To debug put a breakpoint in the code and step through with F8.
  9. 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...
  10. 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...
  11. 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...
  12. niton

    Autosave Attachment and Rename

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

    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 =...
  14. 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 = "" + "" Then newMsg.Recipients.Add recip End If...
  15. 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.
  16. 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
  17. 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...
  18. 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...
  19. 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...
  20. 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()...