From aed6ba6300b6827dac64ae2ba08b2df08c2486ef Mon Sep 17 00:00:00 2001 From: Georgy Litvinov Date: Tue, 17 Mar 2020 16:15:31 +0100 Subject: [PATCH] Fixed bidirectional link macro --- ePublishing/Archive.xba | 30 ++++++++++++++---------------- ePublishing/script.xlb | 1 + 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/ePublishing/Archive.xba b/ePublishing/Archive.xba index f414455..c3c08e2 100644 --- a/ePublishing/Archive.xba +++ b/ePublishing/Archive.xba @@ -1,6 +1,6 @@ -Sub archMark7 +Sub archMark8 End Sub @@ -25,9 +25,11 @@ Sub resetNotesStyle End Sub Sub createBidirectLink - Dim oSelections 'Contains all of the selections - Dim oAnchor1 - Dim oAnchor2 + Dim oSelections As Object + Dim oAnchor1 As Object + Dim oAnchor2 As Object + Dim oAnchor1Name As String + Dim oAnchor2Name As String If IsNull(ThisComponent) Then MsgBox "Ничего не выбрано" @@ -39,18 +41,9 @@ Sub createBidirectLink Exit Sub End If objectsCount = oSelections.getCount() - 1 - If oSelections.getCount() = 0 Then - MsgBox "Ничего не выбрано" - Exit Sub - End If - If oSelections.getCount() <= 2 Then - MsgBox "Нужно выделить два объекта, а не " + objectsCount - Exit Sub - End If - If oSelections.getCount() > 3 Then - MsgBox "Нужно выделить только два объекта, а не " + objectsCount - Exit Sub - End If + If objectsCount < 2 OR objectsCount > 2 Then + MsgBox "Нужно выделить два объекта" + Exit Sub End If oAnchor1 = oSelections.getByIndex(1) oAnchor2 = oSelections.getByIndex(2) @@ -464,8 +457,13 @@ Sub replaceParaStyle MsgBox "Стили не различаются" Exit sub EndIf + If oldStyleName <> "" Then oldStyle = paraStyles.getByName(oldStyleName) + If NOT oldStyle.isUserDefined Then + MsgBox "Невозвожно заменять встроенные стили" + Exit sub + EndIf oldStyle.ParentStyle = newStyleName paraStyles.removeByName(oldStyleName) EndIf diff --git a/ePublishing/script.xlb b/ePublishing/script.xlb index 243339e..4efdd33 100644 --- a/ePublishing/script.xlb +++ b/ePublishing/script.xlb @@ -9,4 +9,5 @@ + \ No newline at end of file