2016-10-13 30 views
0

有沒有人有任何想法,爲什麼這不起作用在發佈者?除了msdn,還有很少的文檔,我無法弄清楚。我每次運行它時,都會說「發佈者無法鏈接到此文本框」。發佈者:鏈接到下一頁上的文本框

是否有一些屬性需要先設置爲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 

回答

相關問題