我想删除并使用Button
在Word(页眉和页脚)中添加现有的Shape但我无法选择形状来改变可见属性。
我该怎么做?我无法弄清楚Word中形状的名称
感谢您的帮助!
Sub LogoChangeVisible()
'
' Removes and adds the logo from Header and Footer
'
'
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
Selection.HeaderFooter.Shapes("Picture from Header").Select
If Selection.ShapeRange.Visible = msoTrue Then
Selection.ShapeRange.Visible = msoFalse
Selection.HeaderFooter.Shapes("Picture from Footer").Select
Selection.ShapeRange.Visible = msoFalse
ElseIf Selection.ShapeRange.Visible = msoFalse Then
Selection.ShapeRange.Visible = msoTrue
Selection.HeaderFooter.Shapes("Picture from Footer").Select
Selection.ShapeRange.Visible = msoTrue
End If
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
End Sub
答案 0 :(得分:0)
如果您添加以下内容:
For Each s In Selection.HeaderFooter.Shapes
Debug.Print s.Name
Next
然后你将在调试窗口中获取名称。另一种方法是忽略名称而改为数字:
Selection.HeaderFooter.Shapes(1)...