Cell.HasText property (Publisher)

Returns a Boolean value indicating whether the specified cell contains any text. Returns True if the specified cell contains text. Read-only.

Syntax

expression.HasText

expression A variable that represents a Cell object.

Example

If shape one on page one contains a table, and the first cell of the table contains text, this example displays the text in a message box.

With ActiveDocument.Pages(1).Shapes(1) 
 
 ' Check for table. 
 If .HasTable Then 
 With .Table.Cells(StartRow:=1, StartColumn:=1, _ 
 EndRow:=1, EndColumn:=1).Item(1) 
 
 ' Check for text in first cell. 
 If .HasText Then 
 MsgBox "Text from first cell of table: " _ 
 & vbCr & .Text 
 Else 
 MsgBox "No text in first cell." 
 End If 
 
 End With 
 Else 
 MsgBox "No table in shape one." 
 End If 
 
End With 

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.