Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Automation Error: The Object Invoked Has Disconnected from Its Clients

Trying to put in validations for a set of Columns and am
using some macros and functions internally to do so.

Following is the code that I'm using to generate the
validations and then apply them to the specifid columns:

-----------------------------------------------------------
Sub CreateValidation(sheetValidation As String, _
rangeStart As String, rangeEnd As
String, _
sheetData As String, colData As
Integer, _
rowDataStart As Integer)

On Error GoTo Errorhandler
Sheets(sheetValidation).Range(rangeStart,
rangeEnd).Select

With Selection.Validation
.Delete
.Add Type:=xlValidateList,
AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:=CreateValidationText
(sheetData, colData, rowDataStart)
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With

Exit Sub

Errorhandler:
MsgBox Err.Number
MsgBox Err.Description
MsgBox Err.Source

End Sub


Function CreateValidationText(sheetData As String, colData
As Integer, rowDataStart As Integer)

Dim retValue As String

For rowNumber = rowDataStart To 65535
If Sheets(sheetData).Cells(rowNumber,
colData).Value = "" Then
Exit For
Else
retValue = retValue & ", " & Sheets
(sheetData).Cells(rowNumber, colData).Value
End If
Next rowNumber

MsgBox "Length: " & Len(retValue)
CreateValidationText = retValue
End Function
-----------------------------------------------------------

I apply the validation using the following call:
CreateValidation "Reports", "H4", "H65535", "DD - Report",
14, 2

I'm using the same code for 7 different sets of columns,
it just fails for the above call and generates the error:
Automation Error: The Object Invoked Has Disconnected from
Its Clients

Please help !

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Object Variable Not Set Error on Selection object Jean Excel Worksheet Functions 3 July 24th 06 06:45 PM
Automation Error xlEnt Excel Discussion (Misc queries) 2 May 15th 06 11:37 PM
Automation Error Bob Barnes Charts and Charting in Excel 3 November 7th 05 08:37 PM
The object invoked has disconnected from its clinets Don[_7_] Excel Programming 2 August 20th 03 02:30 AM
Unknown where is the problem on the Runtime error - Automation error wellie Excel Programming 1 July 10th 03 08:12 AM


All times are GMT +1. The time now is 06:10 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"