Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 03-20-2019, 04:41 PM
mktate mktate is offline Automation Error - the object invoked has disconnected from its clients Windows 10 Automation Error - the object invoked has disconnected from its clients Office 2010 64bit
Novice
Automation Error - the object invoked has disconnected from its clients
 
Join Date: Dec 2015
Posts: 26
mktate is on a distinguished road
Default Automation Error - the object invoked has disconnected from its clients

I have a Word Userform with different command buttons that have worked for over a year - these buttons are used to generate various sets of Word documents. Today when I click on any command button, I get a VBA Automation error message that says "the object invoked has disconnected from its clients." Thereafter, I lose quick access toolbar buttons (the close button for example) and then after using file/close to close any open files, I am unable to completely close Word - it says a dialog box is still open although there are no dialog boxes open (alt-tab and there is nothing open except Word). I have restarted, used the Windows compatibility troubleshooter, reinstalled the normal template, to no avail. Any help is appreciated.
Reply With Quote
  #2  
Old 03-20-2019, 05:27 PM
Guessed's Avatar
Guessed Guessed is offline Automation Error - the object invoked has disconnected from its clients Windows 10 Automation Error - the object invoked has disconnected from its clients Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,163
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

What is the code that is being run when you click on the command button?

If you put a breakpoint in the start of that code, you will be able to step through your code to find the problem.
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #3  
Old 03-20-2019, 06:06 PM
mktate mktate is offline Automation Error - the object invoked has disconnected from its clients Windows 10 Automation Error - the object invoked has disconnected from its clients Office 2010 64bit
Novice
Automation Error - the object invoked has disconnected from its clients
 
Join Date: Dec 2015
Posts: 26
mktate is on a distinguished road
Default Here is the Code - unable to locate an issue

Here is the code. Note that I was unsuccessful in finding a line of code with an issue after adding a breakpoint at the Documents.Add. I am sure the code could be written better but the Code has worked for over a year until today. I really appreciate the reply!

Private Sub cmdMemo_Click()
On Error Resume Next
Documents.Add "path to form/word template"

Dim oDoc As Document
For Each oDoc In Documents
oDoc.Activate
Set oVars = ActiveDocument.Variables
Call FillVariables
Call FillVariables2

If Me.cboNochildren.Value = "0" Then Noofchild0
If Me.cboNochildren.Value = "1" Then Noofchild1
If Me.cboNochildren.Value = "2" Then Noofchild2
If Me.cboNochildren.Value = "3" Then Noofchild3
If Me.cboNochildren.Value = "4" Then Noofchild4

ActiveDocument.Fields.Update


If ActiveDocument.AttachedTemplate.Name <> "Data Set.DOTM" Then ActiveDocument.Fields.Unlink

Dim rngStory As Word.Range
Dim oShape As Word.Shape
For Each rngStory In ActiveDocument.StoryRanges
If rngStory.ShapeRange.Count > 0 Then
For Each oShape In rngStory.ShapeRange
If oShape.TextFrame.HasText Then
oShape.TextFrame.TextRange.Fields.Update
oShape.TextFrame.TextRange.Fields.Unlink
End If
Next oShape
End If
Set rngStory = rngStory.NextStoryRange
Next rngStory

ActiveDocument.Content.NoProofing = False

Next oDoc
Set oVars = Nothing
Me.Hide

End Sub
Reply With Quote
Reply

Tags
vba automation error



Similar Threads
Thread Thread Starter Forum Replies Last Post
I have Error at File System Object: Cant find object or lib johndrew Word VBA 3 07-05-2018 08:46 PM
set row object variable error CLoos Excel Programming 6 03-10-2017 04:48 PM
Contacts disconnected george3095 Outlook 0 10-14-2014 07:15 AM
VBA to identify how Word was invoked Sorcerer13 Word VBA 7 04-24-2014 11:15 AM
Automation Error - the object invoked has disconnected from its clients Automation error Unknown error" message once they open the Excel file hlina Excel 1 10-08-2013 09:14 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:17 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