2016-10-13 4 views
0

Est-ce que quelqu'un a une idée pourquoi cela ne fonctionne pas dans l'éditeur? Il y a très peu de documentation à part MSDN, et je ne peux pas le comprendre. Chaque fois que je l'exécute, il dit simplement "Publisher ne peut pas créer de lien vers cette zone de texte".Éditeur: Lien vers la zone de texte à la page suivante

Y at-il peut-être une propriété que je dois définir en premier? Est-ce une exigence commune dans vba et d'autres langages de programmation?

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 

Répondre