Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 08-23-2021, 08:30 AM
letcall letcall is offline Userform button: the object invoked has disconnected from its clients Windows 10 Userform button: the object invoked has disconnected from its clients Office 2019
Novice
Userform button: the object invoked has disconnected from its clients
 
Join Date: Aug 2021
Posts: 2
letcall is on a distinguished road
Default Userform button: the object invoked has disconnected from its clients

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?
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Automation Error - the object invoked has disconnected from its clients mktate Word VBA 2 03-20-2019 06:06 PM
Executing a userform with a command button spc94 Word VBA 2 06-24-2015 10:08 PM
VBA Code in a UserForm module to delete a Command Button which opens the userform Simoninparis Word VBA 2 09-21-2014 03:50 AM
Command button to show userform suddenly stopped working jpb103 Word VBA 0 05-22-2014 06:05 AM
Word doc bug when closing from userform command button click macro Joe Patrick Word 1 07-05-2011 08:53 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:56 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft