JasonDBurke
Programmer
Hi I was wondering how I go about copying a Word document to the clipboard? This is the code I am trying which copies ONLY the plain text and I need it in Rich Text Format. Thanks!
---------------------------------------
Option Explicit
Dim AppWord As Word.Application
Dim copytext As Variant
Private Sub Command1_Click()
On Error Resume Next
AppWord.ActiveDocument.Close
AppWord.Quit
Set AppWord = GetObject("Word.Application")
AppWord.Visible = True
AppWord.Documents.Open ("C:\test2.doc")
AppWord.ActiveDocument.Select
copytext = AppWord.Selection '<-- only text, no format?
Clipboard.Clear
Clipboard.SetText copytext, vbCFRTF '<-- should work?
AppWord.ActiveDocument.Close
AppWord.Quit
End Sub
----------------------------------------------
---------------------------------------
Option Explicit
Dim AppWord As Word.Application
Dim copytext As Variant
Private Sub Command1_Click()
On Error Resume Next
AppWord.ActiveDocument.Close
AppWord.Quit
Set AppWord = GetObject("Word.Application")
AppWord.Visible = True
AppWord.Documents.Open ("C:\test2.doc")
AppWord.ActiveDocument.Select
copytext = AppWord.Selection '<-- only text, no format?
Clipboard.Clear
Clipboard.SetText copytext, vbCFRTF '<-- should work?
AppWord.ActiveDocument.Close
AppWord.Quit
End Sub
----------------------------------------------