Results 1 to 2 of 2
  1. #1
    DMT Dave is offline VIP
    Windows 10 Access 2016
    Join Date
    May 2018
    Posts
    1,329

    Copy Email to Text box

    Hi Guy's, i am trying to copy an active email body to text box on the form, i am using this method successfully apart from when i shutdown the computer and restart, there are lots of word documents open so then i have to Ctrl Alt Delete to task manager and end word task on each open word doc.



    Can i use the following code and copy from mail body directly to the text box with out using word ??

    This code will copy to word then set a tick box to true, the 2nd code below is clicking on the text box to paste it

    Thank you in advance

    Code:
    Dim WordApp As Word.ApplicationDim wdDoc As Word.Document
    Dim activeMailMessage As MailItem
    Dim rs As DAO.Recordset
    
    
    
    
    If TypeName(ActiveExplorer.Selection.Item(1)) = "MailItem" Then
        Set activeMailMessage = ActiveExplorer.Selection.Item(1)
        Set WordApp = CreateObject("Word.Application")
        WordApp.Visible = False
        Set wdDoc = WordApp.Documents.Add
        If WordApp.Documents.Count > 0 Then
        activeMailMessage.GetInspector().WordEditor.Range.FormattedText.Copy
        wdDoc.Range.Paste
        ActiveDocument.Content.Copy
        End If
    End If
    
    
    Me.tbxPaste = True
    Now click in text box

    Code:
    If Me.tbxPaste = False ThenDoCmd.CancelEvent
    Else
    DoCmd.RunCommand acCmdPaste
    End If
    All works fine but i would like to avoid adding from word document even though i have the following code on a button called "Clear All"


    Code:
    OpenClipboard (0&)
    EmptyClipboard
    CloseClipboard
    Close avtive word doc   Set wdApp = GetObject(, "Word.Application")
        With wdApp.Documents.Count
    
    
        If wdApp.Documents.Count = "0" Then
        DoCmd.CancelEvent
        Else
        wdApp.Quit False
        End If

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,645
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. btn macro what can copy text to clipboard
    By TriFith in forum Import/Export Data
    Replies: 6
    Last Post: 07-01-2016, 02:45 AM
  2. Copy and paste plain text.
    By 316854 in forum Access
    Replies: 9
    Last Post: 12-14-2015, 09:16 PM
  3. VBA - copy memo, paste as text in email app
    By Goodge12 in forum Programming
    Replies: 5
    Last Post: 09-10-2014, 12:12 PM
  4. Copy non-matchable text to another text box
    By Only4Access in forum Programming
    Replies: 1
    Last Post: 01-21-2014, 05:21 PM
  5. Replies: 6
    Last Post: 11-07-2013, 04:02 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums