Я сталкиваюсь с ошибкой Метод или элемент данных не найден при компиляции проекта.Кнопка управления "btnViewUpdateRefresh" существует в другой форме.
Private Sub UserForm_Terminate()
Dim oSection As Word.Section
Dim oRange As Word.Range
Dim var
If Documents("PART V1.0.docm").ProtectionType <> wdNoProtection Then
Documents("PART V1.0.docm").Unprotect "1234"
Else
End If
ThisDocument.Activate
ThisDocument.StoryRanges(wdMainTextStory).Delete
MainWindow.Show
Call MainWindow.btnViewUpdateRefresh_Click --> error points in here.
If Documents("PART V1.0.docm").ProtectionType <> wdNoProtection Then
Else
Documents("PART V1.0.docm").Protect wdAllowOnlyFormFields, True, "1234"
End If
End Sub