![]() |
|
#16
|
||||
|
||||
|
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
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 |
|
#17
|
|||
|
|||
|
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. |
|
|
|
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 |
copy from word into a formatting text box
|
mikewooten | Word | 1 | 06-15-2010 02:04 AM |
Is it possible to create 'balloon' text in docs
|
bubbleboi | Word | 3 | 11-13-2009 01:19 AM |