有没有人知道为什么这不适用于发布商?除了msdn之外,关于它的文档很少,我无法弄明白。每次运行它时,它只是说“Publisher无法链接到此文本框”。
是否可能首先要将某些属性设置为true?这是vba和其他编程语言的常见要求吗?
Option Compare Text
**Sub LinkTextBoxes()**
Dim shpTextBox1 As Shape
Dim shpTextBox2 As Shape
oAPIndex = ActiveDocument.ActiveView.ActivePage.PageIndex
Set shpTextBox1 = FindTB1(ActiveDocument.Pages(oAPIndex))
Set shpTextBox2 = FindTB1(ActiveDocument.Pages(oAPIndex + 1))
If shpTextBox1 Is Nothing Or shpTextBox2 Is Nothing Then
MsgBox ("Textbox missing!" & vbLf & vbLf & "No can do!")
Exit Sub
End If
shpTextBox1.TextFrame.NextLinkedTextFrame = shpTextBox2.TextFrame
ActiveDocument.ActiveView.ActivePage = ActiveDocument.Pages(oAPIndex + 1)
End Sub
**Function FindTB1(oPage As Page) As Shape**
Dim oShape As Shape
Dim oFoundShape As Shape
For Each oShape In oPage.Shapes
If oShape.AlternativeText Like "*Text*" Then
Set oFoundShape = oShape
GoTo Found
End If
Next
Found:
If oFoundShape Is Nothing Then
MsgBox ("Text Box not found on page: " & oPage.PageNumber)
Set FindTB1 = Nothing
Else
Set FindTB1 = oFoundShape
End If
End Function
答案 0 :(得分:0)
对不起伙计们,我想出来了......错过了msdn上的一句话:
https://msdn.microsoft.com/en-us/library/office/ff940597.aspx
表示如果形状已包含文字,它将无效。
看起来我可能要删除文本并重新填写它或类似的东西......