打开一份excel文件,然后循环所有对象。再获取对象内的文本信息进行处理。 For Each shp In sheet.Shapes
Dim sin As Single
Dim d As Date
If Single.TryParse(shp.TextFrame.Characters.Text,sin) = False Then
If Date.TryParse(shp.TextFrame.Characters.Text,d) = False Then
Dim str As String = (shp.TextFrame.Characters.Text)
If shp.TextFrame.Characters.Text <> "" Then
If str.Length > 1 Then
end if
end if
end if
end if
next
现在有一个问题就是循环对象的时候如果有一个对象是图片或者表格之类的,就会报错。
所以想在循环的时候识别是否为文本框对象。
查了excel的vb语言有这样一句
For
Each shp In sheet.Shapes
If shp.ShapeType = msoTextbox Then
End
If
Next shp
但是贴到foxtable里会提示未声明msoTextbox
想问下有什么语句可以在循环对象时候的识别出是否为文本框。
求助