+ Reply to Thread
Results 1 to 6 of 6

Copy Email Text to Word from Excel

  1. #1
    Registered User
    Join Date
    12-01-2012
    Location
    Salt Lake City
    MS-Off Ver
    Excel 2007
    Posts
    11

    Lightbulb Copy Email Text to Word from Excel

    At work every employee has their own signature set up, but it's not just text. There's logo with links along with the agent information. I use a macro built in excel to help agents with verifying all the information they need before they can send an email to the corresponding department they wish to contact.

    At the end of the macro after they provide all the information in the Userform the macro will automatically pull up outlook and paste a message based on the info they provide in the userform. This makes it difficult to use the signature. I've made it so I can paste the signature as text, but the links get messy.

    I have found that if I use the "Copy" function personally and paste it in Word it will paste as the picture instead of text. I know how to copy whatever is selected in the Outlook Email and paste it in word, but I have searched everywhere and was unable to find an answer.

    I would like to be able to select all the text that comes up when the email generates and copy it so I can pull up word and paste it. That way I can put it back in after the text from the userform. Another reason why I sould like to do this is I would be able to avoid the message that comes up asking permission to access the information from outlook. This is what I have so far:

    Sub Email_Generator()
    X = "Hello," & vbCrLf & vbCrLf & "Needed verified info here" & vbCrLf & vbCrLf & "Thank you," & vbCrLf
    Dim OutApp As Object
    Dim OutMail As Object
    Dim WordApp As Object
    Set OutApp = CreateObject ("Outlook.Application")
    Set OutMail = OutApp.CreateItem(0)
    OutMail.display

    'I want to do something like this
    WordApp = CreateObject ("Word.Application")
    WordApp.Document.Add
    OutMail.body.Selection.Copy
    WordApp.Selection.Paste
    signature = WordApp.Selection

    'But right now I'm doing this to make the signature work as best as I can with the hyperlinks and other jargon with it
    signature = OutMail.body

    With OutMail
    .To = "department@workplace.com"
    .CC = "TeamLead@workplace.com"
    .body = X & signature
    End With
    End Sub

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,653

    Re: Copy Email Text to Word from Excel

    Are you wanting to insert your Text before the user's default email signature in an Outlook email? If yes, try this...

    Please Login or Register  to view this content.

    EDIT:

    Or this for HTML format
    Please Login or Register  to view this content.
    This link has additional methods...
    Insert Outlook Signature in mail
    Last edited by AlphaFrog; 06-20-2013 at 12:12 AM.

  3. #3
    Registered User
    Join Date
    12-01-2012
    Location
    Salt Lake City
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Copy Email Text to Word from Excel

    This gives me the same results as I had before with it posting the signature as text with the link verbage and all. It's looking something like this:

    HYPERLINK "http://www.website.com/"Company Name
    Agent Name | Department
    Company Name
    Phone555.555.5555Fax555.555.5555

    HYPERLINK "http://www.website.com/dasfj%$4sdfj;gkaj;lkj$ejo;asdjl" | Email"http://www.website.com/&sd;fkjad;#$%234523RTWdfajfj | VCARD"http://www.website.com/kafjsdl;orj23o;45jgpd89uo;JL:KDUF* | etc. bunchofjibberishandstufflikethat

    When I manually take the signature, paste it into word. Copy it from word and paste it back into outlook it looks like this:

    Agent Name | Department
    Company Name
    Phone555.555.5555Fax555.555.5555

    Do you know how to select the text so I can do the "Copy" command, then select the text in Word and do the "Copy" command?

    I've figured out some temporary code that will work universally with each agent, but still with some hickups in the signature formatting for those agents that have wonky signatures.

    Any help would be great.

    Thanks!

  4. #4
    Registered User
    Join Date
    12-01-2012
    Location
    Salt Lake City
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Copy Email Text to Word from Excel

    Also,

    This won't work:

    SigString = Environ("appdata") & _
    "\Microsoft\Signatures\Mysig.htm"

    because multiple agents will be using this at any given moment and I can't have it search the agent's name then put it in place of "Mysig" to be able to pull the signature correctly.

    Thank you for the help, AlphaFrog, and I look forward to hearing from you.

  5. #5
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,653

    Re: Copy Email Text to Word from Excel

    I can get it to work using HTML formatting in OutLook. My signature has links and an image logo. They are preserved when I use the HTML code I suggested.

    1. What format is OutLook configured to use when creating a new message: HTML, Rich text?
    2. When you tried the code I suggested, which one did you use?
    3. Did you .Display the new email before inserting your text?

    I don't know how to copy-paste-copy from Word.

  6. #6
    Registered User
    Join Date
    12-01-2012
    Location
    Salt Lake City
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Copy Email Text to Word from Excel

    Thank you for responding, AlphaFrog,

    1. everyone's using HTML format.
    2. I have used both suggestions so far. the first still spit it out as text with all the website language.
    3. I did .display before inserting my text.

    Using the HTMLBody one my text wouldn't show up in the email. I tried two different ways:

    1. I tried assigning the HTMLBody to a variable before inserting it at the end of the text
    2. I tried the method of .HTMLBody = X & .HTMLBody

    There is great possibility that I erred when I tried it so I'll try it again later today when I'm at work.
    So far I have it working as best as I can, but if I can get it to do what I'm attempting here, then that would just be fantastic!

    Thanks!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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