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