We recently upgraded our version of Office (subscription plan) and now our user form buttons that call a sub routine, no longer work.
Here is a sample of the code. When the Beta sub is called, the error is displayed and you have to kill the Word session using Task Manager to exit. We have a similar issue with Excel so it seems to be an Office issue.
Code:
Private Sub cmdCancel_Click()
End
End Sub
Private Sub cmdYes_Click()
If OptionButton1 Then Call Beta
If OptionButton2 Then Call Internal
End Sub
Sub Beta()
Unload frmBetaInternal
With Selection
.HomeKey Unit:=wdStory
.Find.ClearFormatting
.Find.Replacement.ClearFormatting
End With
With Selection.Find
.Text = "Contents"
.Forward = True
.Wrap = wdFindContinue
End With
Selection.Find.Execute
Selection.MoveLeft Unit:=wdCharacter, Count:=3
Application.Templates(ActiveDocument.AttachedTemplate.FullName). _
BuildingBlockEntries("Disclaimer").Insert Where:=Selection.Range, RichText:=True
Selection.HomeKey Unit:=wdStory
'Insert draft watermark
Dim oSection As Section
Dim oHeader As HeaderFooter
Dim oRng As Range
For Each oSection In ActiveDocument.Sections
For Each oHeader In oSection.Headers
Set oRng = oHeader.Range
oRng.Collapse wdCollapseEnd
Application.Templates(ActiveDocument.AttachedTemplate.FullName). _
BuildingBlockEntries("DraftWatermark").Insert Where:=oRng, _
RichText:=True
Next oHeader
Next oSection
End Sub
Any advice on what to check?