Results 1 to 17 of 17

Thread: To read Outlook Mailbox

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    I apologize for the duplicate posting since I am new to this forum and was under the impression that each forum was different.

  2. #2
    Administrator VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,493
    Location
    Quote Originally Posted by rolling_zep View Post
    I apologize for the duplicate posting since I am new to this forum and was under the impression that each forum was different.
    Welcome to VBAX rolling_zep. You are right in some ways, all the forums are indeed slightly different and at first somewhat mystifying to the new people. But hey, you have to start somewhere. So here's a couple of things we very much prefer.

    Any question relating to the Office suite. Whilst we are predominately VBA orientated we still try to answer object questions as well; and
    We prefer workbooks with examples whenever possible when posting questions; and
    Code scripts rather than images; and
    When the issue is posted elsewhere, that a link is provided, so we can see what help if any has already been provided; and
    A little understanding that at times maybe even our members may not be able to assist.

    From what I have seen so far you will be a wonderful addition to our membership. Reach out if you have any queries and we'll see what we can do to assist.
    Remember To Do the Following....
    Use [Code].... [/Code] tags when posting code to the thread.
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

  3. #3
    Thank you and if you can see my VBA question in my original post, I need a solution.

    I since modified my entire code but the count is zero, meaning it is not reading the mailbox and attachments.
    Private Sub cmdOutlook_Click()    
    Dim OlItems As Outlook.Items
    Dim olItem As Outlook.MailItem
    Dim olFolder As Outlook.MAPIFolder
    Dim X, y As Long
    Dim strFileName As String
    Dim strFile As String
    
    
    
    
        Set olFolder = Outlook.GetNamespace("MAPI").Folders("WeeklyProceedings Mailbox").Folders("Inbox")
    
    
        
        'providing the object of the mails in the inbox
        Set OlItems = olFolder.Items
        For Each olItem In OlItems
        
            X = olItem.Attachments.Count
            If X > 0 Then
                For y = 1 To X
                    'getting the attachment name
                    strFileName = olItem.Attachments.item(y).FileName
                    'saving the attachment in a temporary location
                    olItem.Attachments.item(y).SaveAsFile "C:\Users\prasad.govindarajan\Testing\" & olItem.Attachments.item(y).FileName
                Next y
            End If
        
        olItem.Save
        Next

    This is my mail setup. I need to read the mails in the Inbox in WeeklyProceedings Mailbox.
    I suspect this line of code
    Set olFolder = Outlook.GetNamespace("MAPI").Folders("WeeklyProceedings Mailbox").Folders("Inbox"). Probably it is not the correct way

    MailBox.jpg
    Last edited by rolling_zep; 08-11-2023 at 01:07 PM.

Posting Permissions

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