+ Reply to Thread
Results 1 to 14 of 14

VBA to send message with signature, but the image does not load.

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    01-11-2016
    Location
    Brazil
    MS-Off Ver
    2010
    Posts
    125

    VBA to send message with signature, but the image does not load.

    Hey guys,

    I am trying to send an email with my signature on it.

    Everything works perfectly, but the picture does not load.

    Here is my code:

    Sub testemail()
    '-----------------------------------------
    'DETERMINE IF EMAIL TO BE SENT
    If MsgBox("Send Email?", vbYesNo + vbQuestion, "Email") = vbYes Then
    '-----------------------------------------
    'DECLARE AND SET VARIABLES
        Dim myOutlok As Object
        Dim myMailItm As Object
        Dim Signature As String
        Shell ("OUTLOOK")
        Set otlApp = CreateObject("Outlook.Application")
        Set OtlNewMail = otlApp.CreateItem(olMailItem)
    '-----------------------------------------
    'GET DEFAULT EMAIL SIGNATURE
        Signature = "C:/Users/joao/AppData/Roaming/Microsoft/Assinaturas/Joćo.htm"
        If Dir(Signature, vbDirectory) <> vbNullString Then
            Signature = Signature & Dir$(Signature & "Joćo*.htm")
        Else:
            Signature = ""
        End If
        Signature = CreateObject("Scripting.FileSystemObject").GetFile(Signature).OpenAsTextStream(1, -2).ReadAll
    '-----------------------------------------
    'CREATE EMAIL
        OtlNewMail.HTMLBody = Signature
        With OtlNewMail
        .To = "[email protected]"
        .CC = Range("H10").Value
        .Subject = "Oi"
        .HTMLBody = "Hello," & "<br />" & Range("H12").Value & "<br />" & "<br />" & "<br />" & _
            "Thank you," & "<br />" & "<br />" & Signature
        .display
        '.Send
        End With
    '-----------------------------------------
    'CLEANUP
        Set OtlNewMail = Nothing
        Set otlApp = Nothing
        Set otlAttach = Nothing
        Set otlMess = Nothing
        Set otlNSpace = Nothing
    End If
    End Sub
    What is wrong?
    Attached Images Attached Images

  2. #2
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: VBA to send message with signature, but the image does not load.

    What's the html source of the signature?

  3. #3
    Forum Contributor
    Join Date
    01-11-2016
    Location
    Brazil
    MS-Off Ver
    2010
    Posts
    125

    Re: VBA to send message with signature, but the image does not load.

    Hey!, the source is Joćo.htm (name of the file)
    Attached Images Attached Images

  4. #4
    Forum Contributor
    Join Date
    01-11-2016
    Location
    Brazil
    MS-Off Ver
    2010
    Posts
    125

    Re: VBA to send message with signature, but the image does not load.

    Maybe this can help you too? I don't know..
    Attached Images Attached Images

  5. #5
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: VBA to send message with signature, but the image does not load.

    Please either attach it or post the actual html code it tags, a picture won't work

  6. #6
    Forum Contributor
    Join Date
    01-11-2016
    Location
    Brazil
    MS-Off Ver
    2010
    Posts
    125

    Re: VBA to send message with signature, but the image does not load.

    how do i do that?

  7. #7
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: VBA to send message with signature, but the image does not load.

    Open it in Chrome, right click, view-source

    Post the the resulting code into the box wrapped in [code][/code] tags

  8. #8
    Forum Contributor
    Join Date
    01-11-2016
    Location
    Brazil
    MS-Off Ver
    2010
    Posts
    125

    Re: VBA to send message with signature, but the image does not load.

    i cant even paste it, its too long

  9. #9
    Forum Contributor
    Join Date
    01-11-2016
    Location
    Brazil
    MS-Off Ver
    2010
    Posts
    125

    Re: VBA to send message with signature, but the image does not load.

    i cant even paste the code, it will have to be through pictures. For some reason, when i paste it here the website blocks it.
    Attached Images Attached Images

  10. #10
    Forum Contributor
    Join Date
    01-11-2016
    Location
    Brazil
    MS-Off Ver
    2010
    Posts
    125

    Re: VBA to send message with signature, but the image does not load.

    And more pictures...
    Attached Images Attached Images

  11. #11
    Forum Contributor
    Join Date
    01-11-2016
    Location
    Brazil
    MS-Off Ver
    2010
    Posts
    125

    Re: VBA to send message with signature, but the image does not load.

    i was pretty stupid, here is the notepad attached.
    Attached Files Attached Files

  12. #12
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: VBA to send message with signature, but the image does not load.

    The problem is how you've linked the image, you really need it on a web server so anyone can access it, or attach it to the email (which is harder). You could host it on something like imgur and then instert the link into your hmtl

  13. #13
    Forum Contributor
    Join Date
    01-11-2016
    Location
    Brazil
    MS-Off Ver
    2010
    Posts
    125

    Re: VBA to send message with signature, but the image does not load.

    but how do i do that?

  14. #14
    Forum Contributor
    Join Date
    01-11-2016
    Location
    Brazil
    MS-Off Ver
    2010
    Posts
    125

    Re: VBA to send message with signature, but the image does not load.

    just the logo in imgur?

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Including image in signature
    By croppman001 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-25-2015, 10:10 AM
  2. [SOLVED] How to add a signature with image using VBA via excel
    By Baldowsky in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-13-2013, 12:58 AM
  3. [SOLVED] VBA to send embedded image in email body- NOT USING THE ORGINAL IMAGE SOURCE
    By Coreyusa in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-27-2013, 06:48 PM
  4. Linking to an image in another cell (Electronic Signature)
    By jonvanwyk in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 12-16-2010, 05:03 PM
  5. Insert signature image - password protected
    By Dusty Hoffman in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-11-2008, 10:41 PM
  6. Replies: 18
    Last Post: 10-11-2007, 04:19 AM
  7. [SOLVED] How to paste a image (signature) in a cell in Excel?
    By V.Jeyakumar in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 06-30-2006, 04:20 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1