Validation list from comma seperated string

G

getvinaygupta

I am trying to put a comma seperated string to a validation list. If
the number of comma seperated values in this string are less, things go
fine, but, when it increases...excel bombs....

Given below is the piece of code I m using :

objRecordset.Open "Select distinct(TABSCHEMA) FROM [Database$] where
DBNAME='" & dbname & "'", _
objConnection, adOpenStatic, adLockOptimistic, adCmdText

Do Until objRecordset.EOF
schlist = objRecordset.Fields.Item("TABSCHEMA") & "," &
schlist
objRecordset.MoveNext
Loop

With Sheet1.Cells(1, 2).Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop,
Operator:= _
xlBetween, Formula1:=schlist
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With

Am I missing something...??

Thanks
Vinay
 
C

Cindy M.

I am trying to put a comma seperated string to a validation list. If
the number of comma seperated values in this string are less, things go
fine, but, when it increases...excel bombs....
Since you haven't gotten a reply here, try in the Excel newsgroup

http://msdn.microsoft.com/newsgroups/default.aspx?dg=microsoft.public.exc
el.programming&lang=en&cr=US

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top