Wrox Programmer Forums
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 20th, 2007, 07:04 AM
Registered User
 
Join Date: Aug 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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






Similar Threads
Thread Thread Starter Forum Replies Last Post
Drag From Word, Drop in TxtBox BrianWren Pro Visual Basic 2005 1 May 12th, 2008 10:17 AM
how to copy text in a word file on the clipboard donrafeal Word VBA 3 February 1st, 2007 12:32 AM
Show DataSet content in a WORD thomaz C# 1 July 7th, 2004 05:15 PM
Copy word to word doc. in VB vamshi Pro VB 6 1 March 24th, 2004 06:25 PM
Copy data to word rajanikrishna Classic ASP Databases 1 September 22nd, 2003 02:27 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.