![]() |
|
#7
|
||||
|
||||
|
The following should work. There is however nothing in that cell in your sample.
Code:
Function GetDeleted(oDoc As Document) As String
Dim oTable As Table
Dim oCell As Range
Dim i As Long
Dim sName As String
Set oTable = oDoc.Tables(1)
For i = 1 To oTable.Rows.Count
If InStr(1, oTable.Cell(i, 1).Range.Text, "Deleted:") > 0 Then
Set oCell = oTable.Cell(i, 2).Range
oCell.End = oCell.End - 1
sName = oCell.Text
Exit For
End If
Next i
GetDeleted = sName
Set oTable = Nothing
Set oCell = Nothing
End Function
Sub Test()
Dim sText As String
sText = GetDeleted(ActiveDocument)
If sText = "" Then
MsgBox "There is no name in the cell", vbCritical
Else
MsgBox sText, vbInformation
End If
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Creating a full page document from a ragged one.
|
Balliol | Word | 5 | 04-28-2021 07:46 PM |
| Full screen view to specific document | matapagi2019 | Word VBA | 0 | 03-17-2019 10:42 AM |
| Detecting that previous character doesn't exist (i.e., present character is first in document) | Robert K S | Word VBA | 15 | 08-01-2016 09:33 AM |
Master document missing images present in Subdocument
|
Dart82 | Word | 2 | 05-05-2014 08:35 AM |
| how to add test in word document | tekle | Word | 2 | 05-24-2010 01:26 PM |