Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
ADG ADG is offline
external usenet poster
 
Posts: 76
Default 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   Report Post  
Posted to microsoft.public.excel.programming
ADG ADG is offline
external usenet poster
 
Posts: 76
Default 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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Opening an Outlook public folder from Excel using a command button... Rob Keel[_2_] Excel Programming 1 July 29th 05 06:02 PM
How do I link to an Outlook public folder from an Excel spreadshe. DJBaker Excel Discussion (Misc queries) 0 January 28th 05 07:35 PM
Link to Public Folder Post? Heather Irvin Excel Programming 0 August 26th 04 09:02 PM
retreiving number of e-mails from public folder in Outlook Barmaley Excel Programming 0 July 17th 03 09:46 PM
retreiving number of e-mails from public folder in Outlook Barmaley Excel Programming 1 July 15th 03 09:47 PM


All times are GMT +1. The time now is 11:03 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"