Microsoft KB Archive/282098

= Visio2000: Sample Macro to Post a Visio File to an Exchange Folder =

Article ID: 282098

Article Last Modified on 1/29/2007

-

APPLIES TO


 * Microsoft Visio 2000 Standard Edition
 * Microsoft Visio 2000 Professional Edition
 * Microsoft Visio 2000 Technical Edition
 * Microsoft Visio 2000 Enterprise Edition

-



This article was previously published under Q282098



SUMMARY
The Microsoft Visio object model does not expose the Post method, which posts a Visio drawing file to a Microsoft Exchange folder. This article demonstrates how to use the Microsoft Outlook object model to complete this task in Microsoft Visual Basic for Applications (VBA).



MORE INFORMATION
Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements.

Sample Code
The following sample code uses the Outlook object model to create a simple mail item, in which a Visio drawing is posted and added as an attachment. Public Sub PostDrawing

Dim olApp As Object Dim olNS As Object Dim oFolder As Object Dim oItem As Object

Set olApp = CreateObject(&quot;Outlook.Application&quot;) Set olNS = olApp.GetNameSpace(&quot;MAPI&quot;) Set oFolder = olNS.PickFolder Set oItem = oFolder.Items.Add(&quot;IPM.Document.*.VSD&quot;) oItem.MessageClass = &quot;IPM.Document.*.VSD&quot;

' Change the file name to your file name and path. oItem.Attachments.Add &quot;C:\Drawing1.vsd&quot;

' Change the Subject line to your text. oItem.Subject = &quot;Drawing1.vsd&quot; oItem.Save End Sub

