VB如何判断WORD中有艺术字?
大虾们:请问VB如何判断WORD中有艺术字?这个问题我已经花了我好长时间了,但都没有解决,大家帮帮忙啊~~~~~~~QQ:297016870 --------------------编程问答-------------------- Dim Wrd_Score(7) As Integer
Dim shp As Shape
Set wrdApp = CreateObject("Word.Application")
wrdApp.Visible = False
wrdApp.Documents.Open "C:\KS\Word.doc"
'wrdApp.Documents("Word.doc").Activate
With wrdApp.Documents("Word.doc")
If .PageSetup.PaperSize = wdPaperA4 Then Wrd_Score(1) = 2
If .Sections(1).PageSetup.Orientation = wdOrientLandscape Then Wrd_Score(2) = 2
If .PageSetup.TopMargin = 56.7 And .PageSetup.BottomMargin = 56.7 And .PageSetup.LeftMargin = 56.7 And .PageSetup.RightMargin = 56.7 Then Wrd_Score(3) = 2
End With
For Each shp In wrdApp.Documents("Word.doc").Shapes
If shp.Type = msoTextEffect Then
If shp.TextEffect.Text = "苏堤春晓" Then MsgBox ("OK")
End If
Next
'If wrdApp.ActiveDocument.Shapes(1).Type = msoTextEffect Then
' If wrdApp.ActiveDocument.Shapes(1).TextEffect.Text = "苏堤春晓" Then MsgBox ("122")
'End If
wrdApp.Quit
Set newWrd = Nothing
Set wrdApp = Nothing
为什么我的程序中shp没有TYPEP这个属性 --------------------编程问答-------------------- 在对象浏览器里找找有没有FontName属性,也可能是Font.Name属性
或者记录宏看看修改字体时候用到哪个属性 --------------------编程问答-------------------- --拿你的代码 ,改造了一下。
Sub Wrd_Score(7)()
Dim shp As Shape
Dim myDocument As Document
Set wrdApp = CreateObject("Word.Application")
wrdApp.Visible = False
Set myDocument = wrdApp.Documents.Open("d:\Word.doc")
'wrdApp.Documents("Word.doc").Activate
' With wrdApp.Documents("Word.doc")
' If .PageSetup.PaperSize = wdPaperA4 Then Wrd_Score(1) = 2
' If .Sections(1).PageSetup.Orientation = wdOrientLandscape Then Wrd_Score(2) = 2
' If .PageSetup.TopMargin = 56.7 And .PageSetup.BottomMargin = 56.7 And .PageSetup.LeftMargin = 56.7 And .PageSetup.RightMargin = 56.7 Then Wrd_Score(3) = 2
' End With
Debug.Print myDocument.Name
'Debug.Print myDocument.Shapes(1).Name
For Each shp In myDocument.Shapes '没有进到FOR 循环,是否我建的d:\Word.doc 文档不够规范,如果可以将代码,发给我,我调试一下,或者你也可以指出我的问题出在哪?
If shp.Type = msoTextEffect Then
If shp.TextEffect.Text = "苏堤春晓" Then MsgBox ("OK")
End If
Next
'If wrdApp.ActiveDocument.Shapes(1).Type = msoTextEffect Then
' If wrdApp.ActiveDocument.Shapes(1).TextEffect.Text = "苏堤春晓" Then MsgBox ("122")
'End If
wrdApp.Quit
Set newWrd = Nothing
Set wrdApp = Nothing
End Sub
补充:VB , VBA