Visio2000: Sample Macro to Post a Visio File to an Exchange Folder (282098)



The information in this article 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("Outlook.Application")
    Set olNS = olApp.GetNameSpace("MAPI")
    Set oFolder = olNS.PickFolder
    Set oItem = oFolder.Items.Add("IPM.Document.*.VSD")
    
    oItem.MessageClass = "IPM.Document.*.VSD"

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

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

REFERENCES

For additional information about how to use the sample code in this article, click the article number below to view the article in the Microsoft Knowledge Base:

277011 Visio2000: How to Run Sample Code from Knowledge Base Articles

Or, go to the following Microsoft Web site:

Modification Type:MinorLast Reviewed:10/11/2006
Keywords:kbdtacode kbhowto KB282098