Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #16  
Old 08-31-2014, 10:08 PM
gmayor's Avatar
gmayor gmayor is offline We have many word docs we need to copy text from Windows 7 64bit We have many word docs we need to copy text from Office 2010 32bit
Expert
 
Join Date: Aug 2014
Posts: 4,137
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

I have had a look at your document and it appears you missed a vital piece of information! The document text is contained in a field result. It is much simpler just to extract the field result e.g.



Code:
Function ExtractTextENV(oDoc As Document) As Boolean
Dim oNewDoc As Document
Dim strNewName As String
Dim oFld As Field
Const strStart As String = "The information received does not support the service requested:"
Const strEnd As String = "The above actions are supported by the following:"
    On Error GoTo Err_Handler
    If InStr(1, oDoc.Range, strStart) > 0 And oDoc.Range.Fields.Count > 2 Then
        Set oNewDoc = Documents.Add(Visible:=False)
        oNewDoc.Range.Text = strStart & vbCr & oDoc.Range.Fields(2).Result & vbCr & strEnd
        oNewDoc.Range.Font.Reset
        strNewName = oDoc.FullName
        strNewName = Left(strNewName, InStrRev(strNewName, Chr(46)) - 1)
        strNewName = strNewName & "EN"
        strNewName = strNewName & Right(oDoc.Name, Len(oDoc.Name) - InStrRev(oDoc.Name, Chr(46)) + 1)
        oNewDoc.SaveAs strNewName, addtorecentfiles:=False
        oNewDoc.Close 0
    Else
        GoTo Err_Handler:
    End If
    ExtractTextENV = True
lbl_Exit:
    Exit Function
Err_Handler:
    ExtractTextENV = False
End Function
If the documents are password protected for forms, then click the require password check box.

Great lyric choice!
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
  #17  
Old 09-02-2014, 07:03 AM
skyslayer skyslayer is offline We have many word docs we need to copy text from Windows 7 64bit We have many word docs we need to copy text from Office 2013
Novice
We have many word docs we need to copy text from
 
Join Date: Aug 2014
Posts: 11
skyslayer is on a distinguished road
Default

Graham you are the man

Looks good and thank you for all your help I will be using your donation button on your site for the Word Batch Process.
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy Text Twice to Paste into word Albundy Word 2 09-02-2016 12:59 PM
Text Shifting When Saving Word 2007 Docs DerekS Word 1 09-21-2013 02:42 AM
Can't copy/cut and paste text in Word 2002 mmiller751 Word 0 04-17-2012 02:55 PM
We have many word docs we need to copy text from copy from word into a formatting text box mikewooten Word 1 06-15-2010 02:04 AM
We have many word docs we need to copy text from Is it possible to create 'balloon' text in docs bubbleboi Word 3 11-13-2009 01:19 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 08:10 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft