Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Programmatically posting to a specific Exchange public folder

16 views
Skip to first unread message

Bill Youngman

unread,
Oct 11, 2001, 10:55:07 AM10/11/01
to
Is there a way to post a Word document or an Excel workbook to a specific Exchange public folder w/o having the dialog box pop up prompting the user for the destination folder?
 
TIA,
Bill Youngman

Alan Perkins

unread,
Oct 11, 2001, 1:11:15 PM10/11/01
to
Hi Bill,
 
I think this is the kind of thing you're looking for
 
Private Sub PostPublic(ByRef wbkX As Excel.Workbook)
Dim objOutl As Outlook.Application
Dim objNS As Outlook.Namespace
Dim objFolder As Outlook.MAPIFolder
Dim objOLitem As Outlook.PostItem
    Set objOutl = New Outlook.Application
    Set objNS = objOutl.GetNamespace("MAPI")
    Set objFolder = objNS.Folders("Public Folders")
    Set objFolder = objFolder.Folders("All Public Folders")
 
    ' work down to the relevant folder
    Set objFolder = objFolder.Folders("Public Folder 1") 
    Set objFolder = objFolder.Folders("Public Folder 2")
    Set objFolder = objFolder.Folders("Public Folder 3")

    With objFolder.Items.Add(olPostItem)
      .Subject = wbkX.Name
      .Attachments.Add wbkX.FullName
      .Post
    End With
    wbkX.Close savechanges:=False
End Sub
 
You will, of course need a reference to Outlook
 
HTH
 
Alan P.
"Bill Youngman" <byou...@impacthealth.com> wrote in message news:ugLc$SmUBHA.1680@tkmsftngp07...

Jürgen Häußner

unread,
Oct 13, 2001, 5:51:54 PM10/13/01
to
hi,

interesting, because I have the same problem.
but is it also possible, to post it directly into the folder (without being
an attachment)?

thanks & ciao
jürgen.

"Alan Perkins" <al...@perkins55.freeserve.co.uk> schrieb im Newsbeitrag
news:O#CKIfnUBHA.1384@tkmsftngp05...

neo [mvp - outlook]

unread,
Oct 13, 2001, 6:32:54 PM10/13/01
to
Yes...


' This is just part of an Outlook 2000/2002 VBA macro
Set objFolder = Application.ActiveExplorer.CurrentFolder
Set colItems = objFolder.Items

Set objDocument = colItems.Add ("IPM.Document.Word.Document.8")

' strFilePath is a string variable that holds the path/filename information
objDocument.Attachments.Add strFilePath
objDocument.Subject = "A Word Document"

' Must set the message class explicitly for Word documents
objDocument.MessageClass = "IPM.Document.Word.Document.8"
objDocument.Save

objDocument.Display

set objDocument = Nothing

"Jürgen Häußner" <juergen....@t-online.de> wrote in message
news:9qad7a$lhu$05$1...@news.t-online.com...

Jürgen Häußner

unread,
Oct 14, 2001, 2:28:07 AM10/14/01
to
great, thanks
jürgen


"neo [mvp - outlook]" <n...@mvps.org> schrieb im Newsbeitrag
news:#9QOHbDVBHA.2060@tkmsftngp07...

Bill Youngman

unread,
Oct 15, 2001, 3:46:14 PM10/15/01
to
Thanks, that's exactly what I was looking for.

"neo [mvp - outlook]" <n...@mvps.org> wrote in message
news:#9QOHbDVBHA.2060@tkmsftngp07...

0 new messages