+ Reply to Thread
Results 1 to 28 of 28

adding a signature to email though excel

  1. #1
    Registered User
    Join Date
    07-14-2021
    Location
    england
    MS-Off Ver
    pro plus 2016
    Posts
    31

    adding a signature to email though excel

    hi ,
    i had some help on here a while back creating some code to save files as a .pdf to a certain folder and then to add one of the sheets to a email ,
    this has worked great , but i now have other people using the files ,
    and want to make parts of the sheet easier / foolproof to use !

    basically i would like to add the default outlook signature , so no matter what computer the files are on it will always add whatever the default signature is,
    and i would like the to email address to be whatever is on cell D10 of sheet QUOTATION
    and also add on the email body "To / Hi" to whatever is on cell D11 of sheet QUOTATION

    i will add the code below
    if any of this is not possible , then not a problem
    but any help will be much appreciated

    Please Login or Register  to view this content.
    thanks in advance
    dave
    Last edited by daveeps; 08-11-2022 at 07:20 AM.

  2. #2
    Forum Contributor
    Join Date
    12-10-2013
    Location
    Mississippi, United States
    MS-Off Ver
    2016
    Posts
    120

    Re: adding a signature to email though excel

    This might Work for You.
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    07-14-2021
    Location
    england
    MS-Off Ver
    pro plus 2016
    Posts
    31

    Re: adding a signature to email though excel

    hi aworfolk

    many thanks for your reply ,
    i tried this but this line kept coming back as an error 9
    Please Login or Register  to view this content.

  4. #4
    Forum Contributor
    Join Date
    12-10-2013
    Location
    Mississippi, United States
    MS-Off Ver
    2016
    Posts
    120

    Re: adding a signature to email though excel

    daveeps

    Try this. I have taken the code I use and tried to input your information in.

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    07-14-2021
    Location
    england
    MS-Off Ver
    pro plus 2016
    Posts
    31

    Re: adding a signature to email though excel

    unfortunately this isn't working for me either ,
    comes back with an error

    compile error :
    User - defined type not defined

    i apologize i have very basic skills regarding VBA .
    so all im doing it copying your code and testing

  6. #6
    Forum Contributor
    Join Date
    12-10-2013
    Location
    Mississippi, United States
    MS-Off Ver
    2016
    Posts
    120

    Re: adding a signature to email though excel

    That is fine could you please hit the Debug and paste what line is giving this error so I can look into fixing it.

    Thanks

  7. #7
    Registered User
    Join Date
    07-14-2021
    Location
    england
    MS-Off Ver
    pro plus 2016
    Posts
    31

    Re: adding a signature to email though excel

    this is what the dialog box says

    compile error :
    User - defined type not defined

    and highlights this bit of the code

    Please Login or Register  to view this content.

  8. #8
    Forum Contributor
    Join Date
    12-10-2013
    Location
    Mississippi, United States
    MS-Off Ver
    2016
    Posts
    120

    Re: adding a signature to email though excel

    I found where I mis-defined the body.
    Sorry about that

    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    07-14-2021
    Location
    england
    MS-Off Ver
    pro plus 2016
    Posts
    31

    Re: adding a signature to email though excel

    still the same compile error and highlighting the same bit of code which is the first line

    Please Login or Register  to view this content.

  10. #10
    Forum Contributor
    Join Date
    12-10-2013
    Location
    Mississippi, United States
    MS-Off Ver
    2016
    Posts
    120

    Re: adding a signature to email though excel

    Lets check something.

    In the VBA Screen go to Tools.
    Then References.
    There should be a box checked call Microsoft Outlook 16.0 Object Library.

    If not scroll down and select this box.

  11. #11
    Registered User
    Join Date
    07-14-2021
    Location
    england
    MS-Off Ver
    pro plus 2016
    Posts
    31

    Re: adding a signature to email though excel

    yes this is selected ,
    i remember doing this one last time as it was unchecked and parts of the code didnt work

  12. #12
    Forum Contributor
    Join Date
    12-10-2013
    Location
    Mississippi, United States
    MS-Off Ver
    2016
    Posts
    120

    Re: adding a signature to email though excel

    I am running out of Ideas for this Problem.

    Here are the References that I have checked.

    Visual Basic For Applications
    Microsoft Excel 16.0 Object Library
    OLE Automation
    Microsoft office 16.0 Object Library
    Microsoft Outlook 16.0 Object Library

  13. #13
    Registered User
    Join Date
    07-14-2021
    Location
    england
    MS-Off Ver
    pro plus 2016
    Posts
    31

    Re: adding a signature to email though excel

    no problems ,
    thank you for trying ,

    can anyone else help ?

  14. #14
    Forum Contributor
    Join Date
    12-10-2013
    Location
    Mississippi, United States
    MS-Off Ver
    2016
    Posts
    120

    Re: adding a signature to email though excel

    Try to download this file and see if you can run it through this.
    If this does not work then I can not help sorry.
    Attached Files Attached Files

  15. #15
    Registered User
    Join Date
    07-14-2021
    Location
    england
    MS-Off Ver
    pro plus 2016
    Posts
    31

    Re: adding a signature to email though excel

    i have downloaded the file ,
    opened it and hit the generate email button.
    the new message box opened up but with no default signature on ,
    this is what was in the email body ,

    To/Hi,
    tester
    Add Signature Here


    looking around the internet for a fix on this and seems many people have problems with adding the signature,
    and with very conflicting coding.

    but many thanks for all your help

  16. #16
    Forum Contributor
    Join Date
    12-10-2013
    Location
    Mississippi, United States
    MS-Off Ver
    2016
    Posts
    120

    Re: adding a signature to email though excel

    In the Code you can write out your signature line where it says "Add Signature Here". Then remove the ' from the front of source_file and .Attachment. If you need the email to go the next line for the signature Add & vbNewLine & then add the next line.

    so essentially something like this.

    Please Login or Register  to view this content.

  17. #17
    Forum Expert KOKOSEK's Avatar
    Join Date
    08-03-2018
    Location
    Pole in Yorkshire, UK
    MS-Off Ver
    365/2013
    Posts
    2,744

    Re: adding a signature to email though excel

    Do you want to add default signature which you got set in your outlook?
    Happy with my answer * Add Reputation.
    If You are happy with solution, please use Thread tools and mark thread as SOLVED.

  18. #18
    Registered User
    Join Date
    07-14-2021
    Location
    england
    MS-Off Ver
    pro plus 2016
    Posts
    31

    Re: adding a signature to email though excel

    Quote Originally Posted by KOKOSEK View Post
    Do you want to add default signature which you got set in your outlook?
    hi ,
    yes but using the code in my first post .

    is this possible ?

  19. #19
    Forum Expert KOKOSEK's Avatar
    Join Date
    08-03-2018
    Location
    Pole in Yorkshire, UK
    MS-Off Ver
    365/2013
    Posts
    2,744

    Re: adding a signature to email though excel

    First you have to locate file/files on your computer where signature files are located.
    It should be something like this:

    44279_1.png

    you also need this function:

    Please Login or Register  to view this content.

    then in vba:
    Please Login or Register  to view this content.
    and in "Signature" you've got now your signature, so:

    Please Login or Register  to view this content.
    In complete looks like:


    Please Login or Register  to view this content.

  20. #20
    Registered User
    Join Date
    07-14-2021
    Location
    england
    MS-Off Ver
    pro plus 2016
    Posts
    31

    Re: adding a signature to email though excel

    i have copied and tried the code adding my signature location ,
    but seem to get an error.
    here is my findings

    runtime error `52`:
    bad file name or number

    highlighting this code
    Please Login or Register  to view this content.
    i have tried this in a new file too just in case there is no conflicts with what i have on my worksheet

  21. #21
    Forum Expert KOKOSEK's Avatar
    Join Date
    08-03-2018
    Location
    Pole in Yorkshire, UK
    MS-Off Ver
    365/2013
    Posts
    2,744

    Re: adding a signature to email though excel

    Error is clear

    Please Login or Register  to view this content.
    are You correctly set file name and path in this line

    Please Login or Register  to view this content.
    add
    Please Login or Register  to view this content.
    and check that file is there and its name is correct

  22. #22
    Registered User
    Join Date
    07-14-2021
    Location
    england
    MS-Off Ver
    pro plus 2016
    Posts
    31

    Re: adding a signature to email though excel

    so ive had a play with the code and this is what ive found .
    using F8 i have gone through the code by each string.
    once the email displays, the signature is there until it adds the next code
    Please Login or Register  to view this content.
    then the signature disappears and is replaced by my email body text.

    i have tried
    Please Login or Register  to view this content.
    but seems to do nothing .
    and ive tried the above code which gets the signature from the file and that also seems to do nothing ?
    any help will be much appreciated
    here is where i have got my code too now which works perfect but with out a signature
    Please Login or Register  to view this content.

  23. #23
    Forum Expert KOKOSEK's Avatar
    Join Date
    08-03-2018
    Location
    Pole in Yorkshire, UK
    MS-Off Ver
    365/2013
    Posts
    2,744

    Re: adding a signature to email though excel

    Try this:

    Please Login or Register  to view this content.
    and check attached file (put both files in the same folder and 100% works)

    p.s. I have to zip mysignature.html because forum does not accept html files as attachment.
    Attached Files Attached Files

  24. #24
    Registered User
    Join Date
    07-14-2021
    Location
    england
    MS-Off Ver
    pro plus 2016
    Posts
    31

    Re: adding a signature to email though excel

    ive tried this and still doesn't seem to work .
    the email is all there as it should but no signature .

    i tried it on your sheet which i downloaded and also on my excel sheet.

    if i go back to my sheet and delete this code

    Please Login or Register  to view this content.
    then the email comes up with the signature ?

  25. #25
    Forum Contributor
    Join Date
    12-10-2013
    Location
    Mississippi, United States
    MS-Off Ver
    2016
    Posts
    120

    Re: adding a signature to email though excel

    Not an expert with Excel to Outlook but from the testing I have done the email generates with signature filled in and then when you edit the body as what the excerpt of code you show does it erases everything and replaces it with the text you provide. I would suggest adding your signature to the end of the code to look something like this:

    Please Login or Register  to view this content.

  26. #26
    Registered User
    Join Date
    07-14-2021
    Location
    england
    MS-Off Ver
    pro plus 2016
    Posts
    31

    Re: adding a signature to email though excel

    thanks for your testing on this ,
    i can see what you have done and i did have this type of text signature before,
    but on my standard email i have an image signature through outlook and wanted this to match up .
    also my colleagues have their own signatures which is different to mine that is why i was trying to have the default outlook signature set .

    but after lots of googling and adding lots of different codes im thinking its not going to work to have a image signature and a auto text body at the same time .
    seems like its either one or the other !!

  27. #27
    Forum Contributor
    Join Date
    12-10-2013
    Location
    Mississippi, United States
    MS-Off Ver
    2016
    Posts
    120

    Re: adding a signature to email though excel

    Sorry,

    This is out of my wheelhouse. If you or somebody in the community can get the body of the Email before you enter in your information as a variable, then the variable will have to get added to the end of the body.

  28. #28
    Registered User
    Join Date
    07-14-2021
    Location
    england
    MS-Off Ver
    pro plus 2016
    Posts
    31

    Re: adding a signature to email though excel

    No need to apologize 😁
    Thank you for taking the time to look into the problem for me,
    As I said I'm quite new to VBA, I can do basic code and I can see what I want to do but not the knowledge to implement it !
    Hopefully someone who has will have the answer
    But thanks again for trying ☺️

+ 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. Adding Outlook Email to Signature
    By ExcelFish2020 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-29-2020, 08:33 AM
  2. Adding signature & hyperlinks to email via excel VBA
    By WombleJim in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-08-2020, 10:29 AM
  3. Adding Default Signature to Macro Generated Email
    By michaelobecker in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-06-2018, 02:56 PM
  4. Trouble adding a signature to a VBA coding to send an email
    By chrisellis250 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-12-2017, 05:02 AM
  5. Replies: 3
    Last Post: 04-15-2015, 09:34 PM
  6. [SOLVED] Excel VBA code for saving PDF to file & adding default signature to Email
    By bdouglas1011 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-02-2014, 01:54 AM
  7. Adding Signature in Email through VBA issue
    By naveenmarapaka in forum Outlook Programming / VBA / Macros
    Replies: 0
    Last Post: 09-24-2012, 05:30 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