OL2000: Programmatically Created Attachment Loses Icon

ID: Q222479


The information in this article applies to:
  • Microsoft Outlook 2000


SYMPTOMS

Using Microsoft Visual Basic Scripting Edition (VBScript) or Microsoft Visual Basic for Applications code, you can attach one Outlook item to another.

If you send a mail message with such an attachment, the person who receives the message may not be able to see the icon for the attachment. The attached item however, is intact and functions correctly.


RESOLUTION

When attaching the second item to the first, use the ActiveInspector.CurrentItem object to reference the attached item. For an example of how to resolve this problem, see the commented code in the "Steps to Reproduce the Problem" section of this article.


STATUS

Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article.


MORE INFORMATION

Microsoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals 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 needs. If you have limited programming experience, you may want to contact a Microsoft Certified Solution Provider or the Microsoft fee-based consulting line at (800) 936-5200. For more information about Microsoft Certified Solution Providers, please see the following page on the World Wide Web:

http://www.microsoft.com/mcsp/
For more information about the support options available from Microsoft, please see the following page on the World Wide Web:

http://www.microsoft.com/support/supportnet/overview/overview.asp

Steps to Reproduce the Problem

  1. Create a new mail message.


  2. On the Tools menu, point to Forms, and then click Design This Form.


  3. Drag to resize the message control, creating enough space for a CommandButton.


  4. Click the Control Toolbox button to view the Control Toolbox and drag a CommandButton to the form.


  5. On the Form menu, click View Code and then type the following VBScript code in the Script Editor. In the ninth line of the following code, be sure to change the placeholder to your e-mail name.


  6. 
    Sub CommandButton1_Click()
    
       ' Saves the current mail item in the Inbox.
       Item.Save
    
       ' Create a new mail message.
       Set ItemToSend = Application.CreateItem(0)
    
       ' Change following line to your e-mail name to send message.
       ItemToSend.To = "Enter your e-mail here!"
    
       ItemToSend.Subject = "test"
    
       ' The following line results in a blank icon for attachment.
       ' 4 is the olAttachmentType constant olByValue to create a link.
       ItemToSend.Attachments.Add Item, 4
    
       ' The following line will preserve the icon in the sent message
       ' if you substitute it for the line above.
       'ItemToSend.Attachments.Add Application.ActiveInspector.CurrentItem, 4
       ItemToSend.Send
    
    End Sub 
  7. Close the VBScript Editor.


  8. On the Form menu, click Run This Form.


  9. Click CommandButton1 to run the VBScript code.


You should receive a new message in your Inbox that contains the blank attachment icon. If you click the upper-left portion of the message area, you will see the bounding outline for the icon.


REFERENCES

For additional information about available resources and answers to commonly asked questions about Microsoft Outlook 2000 solutions, please see the following article in the Microsoft Knowledge Base:

Q146636 OL2000: Questions About Custom Forms and Outlook Solutions

Additional query words: OutSol OutSol2000

Keywords : kbdta
Version : WINDOWS:2000
Platform : WINDOWS
Issue type : kbbug


Last Reviewed: December 10, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.