C
Christian Treffler
Hello,
I'm getting the "Object disconnected from client..' error message in my
VBA project (Excel 2003 on Windows XP professional, all latest patches
installed).
First, here's an excerpt of the code:
Sub CheckPT()
Application.Goto Reference:="IFailureModeM"
' This is on Worksheets("Questionnaire")
If Range("IPackageType").Value = _
Worksheets("Supporting Data").Range("LPT_BGA").Value Then
' Omitted, because this section is not executed
Else ' occurs when "LPT_BGA" is empty
With Selection.Validation
.Delete
' ***The error occurs in the next statement***
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, _
Operator:=xlBetween, Formula1:="=LFM_Empty"
.IgnoreBlank = True
.InCellDropdown = True
.ShowInput = False
.ShowError = True
End With
End If
End Sub
This sub is called from several other subs without any problem. The
problem occurs, when I open a custom dialog box (userform) with a
checkbox, OK and Cancel button. After clicking OK, the above sub is
called. Due to other actions, the if statement will always perform the
else clause on this occasion. And here the error occurs, but funny
enough it occurs *after* the .Delete statement. The .Delete statement is
executed correctly.
I have checked everything I could find regarding that error message, but
cannot get behind the root cause. It does not seem to be connected to
unqualified property call (At least I cannot make it work with a
qualified call - Or I do not understand the qualified/unqualified issue)
If somebody is interested, below is the code of the sub which opens the
dialog box.
Can anybody help me with that problem?
TIA,
Christian
Public Sub ClearQuestionnaire()
BtnNewDlg.Show
Application.EnableEvents = False
' Dissable change events, because sheet will be changed by
' following subs
' The following actions all take place on
' Worksheets("Questionnaire")
For Each c In Range("HAllData").Cells ' Go through all cells
c.MergeArea.ClearContents ' and delete content
Next c ' in "HAllData"
CheckQuestionnaire
' This sub calles 3 other subs prior to CheckPT() which perform
' actions on Worksheets("Questionnaire").
' Some of these are similar to the one in the failing CheckPT(),
' but they work fine.
End Sub
I'm getting the "Object disconnected from client..' error message in my
VBA project (Excel 2003 on Windows XP professional, all latest patches
installed).
First, here's an excerpt of the code:
Sub CheckPT()
Application.Goto Reference:="IFailureModeM"
' This is on Worksheets("Questionnaire")
If Range("IPackageType").Value = _
Worksheets("Supporting Data").Range("LPT_BGA").Value Then
' Omitted, because this section is not executed
Else ' occurs when "LPT_BGA" is empty
With Selection.Validation
.Delete
' ***The error occurs in the next statement***
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, _
Operator:=xlBetween, Formula1:="=LFM_Empty"
.IgnoreBlank = True
.InCellDropdown = True
.ShowInput = False
.ShowError = True
End With
End If
End Sub
This sub is called from several other subs without any problem. The
problem occurs, when I open a custom dialog box (userform) with a
checkbox, OK and Cancel button. After clicking OK, the above sub is
called. Due to other actions, the if statement will always perform the
else clause on this occasion. And here the error occurs, but funny
enough it occurs *after* the .Delete statement. The .Delete statement is
executed correctly.
I have checked everything I could find regarding that error message, but
cannot get behind the root cause. It does not seem to be connected to
unqualified property call (At least I cannot make it work with a
qualified call - Or I do not understand the qualified/unqualified issue)
If somebody is interested, below is the code of the sub which opens the
dialog box.
Can anybody help me with that problem?
TIA,
Christian
Public Sub ClearQuestionnaire()
BtnNewDlg.Show
Application.EnableEvents = False
' Dissable change events, because sheet will be changed by
' following subs
' The following actions all take place on
' Worksheets("Questionnaire")
For Each c In Range("HAllData").Cells ' Go through all cells
c.MergeArea.ClearContents ' and delete content
Next c ' in "HAllData"
CheckQuestionnaire
' This sub calles 3 other subs prior to CheckPT() which perform
' actions on Worksheets("Questionnaire").
' Some of these are similar to the one in the failing CheckPT(),
' but they work fine.
End Sub