+ Reply to Thread
Results 1 to 2 of 2

Help with Posting to a public Folder

  1. #1
    ADG
    Guest

    Help with Posting to a public Folder

    I am trying to send a daily report to a Public Folder in Outlook. The folder
    name is "Public Folders\UK\Finance Reports\Material Results" (assuming that
    \ is used to split up the sub folders).


    My code so far is

    Public Sub PostOutlookFolder(strFileName)
    Dim myOlApp As Outlook.Application
    Dim myNameSpace As Outlook.NameSpace
    Dim myPost As Outlook.PostItem
    Dim myAttachs As Outlook.Attachments
    Dim myAttach As Outlook.Attachment

    Set myOlApp = CreateObject("Outlook.Application")
    Set myNameSpace = myOlApp.GetNamespace("MAPI")
    Set myPost = myOlApp.CreateItem(olPostItem)
    Set myAttachs = myPost.Attachments
    Set myAttach = myAttachs.Add(strFileName, olByValue, 1, "Material Result")

    myPost.Subject = "Material Result - " & Format(Now() - 1)

    myPost.Post
    Set myAttach = Nothing
    Set myAttachs = Nothing
    Set myPost = Nothing
    Set myNameSpace = Nothing
    myOlApp.Quit
    Set myOlApp = Nothing
    End Sub

    This posts to my inbox. How do I set the folder to post to, I cannot see the
    appropriate property / method.

    Thanks in advance
    --
    Tony Green

  2. #2
    ADG
    Guest

    RE: Help with Posting to a public Folder

    OK found my error with help from VBA forum. I need to create a folder and use
    add item. Create item always creates in the inbox
    --
    Tony Green


    "ADG" wrote:

    > I am trying to send a daily report to a Public Folder in Outlook. The folder
    > name is "Public Folders\UK\Finance Reports\Material Results" (assuming that
    > \ is used to split up the sub folders).
    >
    >
    > My code so far is
    >
    > Public Sub PostOutlookFolder(strFileName)
    > Dim myOlApp As Outlook.Application
    > Dim myNameSpace As Outlook.NameSpace
    > Dim myPost As Outlook.PostItem
    > Dim myAttachs As Outlook.Attachments
    > Dim myAttach As Outlook.Attachment
    >
    > Set myOlApp = CreateObject("Outlook.Application")
    > Set myNameSpace = myOlApp.GetNamespace("MAPI")
    > Set myPost = myOlApp.CreateItem(olPostItem)
    > Set myAttachs = myPost.Attachments
    > Set myAttach = myAttachs.Add(strFileName, olByValue, 1, "Material Result")
    >
    > myPost.Subject = "Material Result - " & Format(Now() - 1)
    >
    > myPost.Post
    > Set myAttach = Nothing
    > Set myAttachs = Nothing
    > Set myPost = Nothing
    > Set myNameSpace = Nothing
    > myOlApp.Quit
    > Set myOlApp = Nothing
    > End Sub
    >
    > This posts to my inbox. How do I set the folder to post to, I cannot see the
    > appropriate property / method.
    >
    > Thanks in advance
    > --
    > Tony Green


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1