troubleshooting Question

Icon in Lotus Notes appearing as gray icon

Avatar of amfierst
amfierstFlag for United States of America asked on
Lotus IBMMicrosoft Excel
14 Comments1 Solution3514 ViewsLast Modified:
I have VBA code that sends an email with an attachment when executed.  The attachment is an excel spreadsheet.  When the email is received, however, a gray icon appears in the email instead of the excel icon.  Whey I try to process this attachment through vba code, the attachment is not viewed as a RICHTEXT, but rather as TEXT, which is preventing me from detaching it via VBA.  How do I get the icon to display as an Excel icon?

My code for attaching the email and sending it is shown below:

  ' Declare Variables for file and macro setup

    Dim UserName, MailDbName, MailMessage As String
    Dim Maildb, MailDoc, Session, EmbedObj1, AttachME As Object
    Dim RichTextBody, RichTextAttachment As Object
   
' Open and locate current LOTUS NOTES User

    Set Session = CreateObject("Notes.NotesSession")
    UserName = Session.UserName
    MailDbName = Left$(UserName, 1) & Right$(UserName, (Len(UserName) - InStr(1, UserName, " "))) & ".nsf"
    Set Maildb = Session.GETDATABASE("", MailDbName)
    If Maildb.IsOpen = True Then
    Else
        Maildb.OPENMAIL
    End If

    Set MailDoc = Maildb.CreateDocument
    MailDoc.Form = "Memo"
    Recipient = "email id"
    MailDoc.SendTo = Recipient
    MailDoc.Subject = "PILOT: Software Audit Results"
    MailMessage = "Software audit results attached."
    Set RichTextBody = MailDoc.CREATERICHTEXTITEM("Body")

    MailDoc.Body = MailMessage
    MailDoc.SAVEMESSAGEONSEND = True
   
    If Attachment1 <> "" Then
        Set AttachME = MailDoc.CREATERICHTEXTITEM("Attachment")
        Set EmbedObj = AttachME.EMBEDOBJECT(1454, "", Attachment1, "Attachment")

    End If
   
    MailDoc.PostedDate = Now()
    On Error GoTo ErrorHandler1
    MailDoc.Send 0, Recipient

    Set Maildb = Nothing
    Set MailDoc = Nothing
    Set Session = Nothing
    Set EmbedObj1 = Nothing
    Set AttachME = Nothing

Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 14 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 14 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros