Copy txtBox content to Word
Hello,
I have Memo field RtxtBox1 (RichTextBox type) in Form1 in Base.
I need to copy text from RtxtBox1 into Word document but to preserve original formatting.
If I do this:
'Copy RichTextBox content
Base.Form1.RtxtBox1.SetFocus
DoCmd.RunCommand acCmdCopy
'... and paste it into Word file Document
Dim oApp As Object
Set oApp = CreateObject(Class:="Word.Application")
oApp.Visible = True
oApp.Documents.Open FileName:="Document.doc"
oApp.Selection.Range.PasteAndFormat (wdFormatOriginalFormatting)
I got following results:
If my text in Access is for instance:
"This is text"
In Word I got:
"This is text"
???
If I put wdFormatPlainText instead of wdFormatOriginalFormatting I got the same result ?!?
What is going on here ? How to keep the original formatting ?
Access and Word are 2007 version, and Paste options in Word Options/Advanced are all on Default.
Does anybody know some other way to copy memo field into word in two cases:
- keep source formatting
- keep original formatting
Best regards,
Zoran
|