返回一个与对象的某一方面相关的 String。
expression.toString
expression 必选。返回 DispFPHTMLDocument 对象的表达式。
多数对象不支持 toString 方法。如果由一个不支持的对象执行,它将总是返回 String "[object]"。
下列示例显示与活动文档的位置属性相关的字符串。
Sub ReadString()
Dim FPApp As FrontPage.Application
Dim objDoc As Object
Set FPApp = FrontPage.Application
Set objDoc = FPApp.ActiveDocument.location
If objDoc Is Nothing Then
MsgBox "There is no current active document."
Else
MsgBox "The string associated with this object is: " & objDoc.toString
End If
End Sub