Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Other Office > Word VBA
|
Word VBA Discuss using VBA to program Word.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Word 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 July 14th, 2011, 06:07 AM
Authorized User
 
Join Date: May 2011
Posts: 44
Thanks: 7
Thanked 0 Times in 0 Posts
Exclamation importing formatted text from one document to another

Hi,

I am trying to import formatted text from an existing word document using the code below:

Code:
        Dim appSupply As Word.Application
        Dim docSupply As Word.Document
        Set appSupply = Word.Application
        Set docSupply = appSupply.Documents.Open("H:\proposalDocumentDevelopment\proposalTemplates\scopeOfSupply.docx")
    
        rngSupplyBody = vbNewLine & docSupply.Bookmarks("test").Range.FormattedText & vbNewLine
        docSupply.Close wdDoNotSaveChanges
        
        ''Re-insert the bookmark
        ActiveDocument.Bookmarks.Add "bmSupplyBody", rngSupplyBody
Unfortunately, it brings over the text but it is not formatted.

Can anybody help?

Thanks





Similar Threads
Thread Thread Starter Forum Replies Last Post
Try It Out - Adding Formatted Text p. 54 gerry789 BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 3 October 29th, 2011 11:17 AM
Importing Fixed Width .txt Document and Then Some! Diretemus Access VBA 8 March 26th, 2008 07:27 AM
Importing a text file DBN Beginning VB 6 6 April 24th, 2006 02:52 PM
HTML formatted text via xsl templates? beckfield XSLT 2 February 26th, 2005 01:48 PM
Formatted/HTML text pkgal79 HTML Code Clinic 2 June 18th, 2003 02:18 AM





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