View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.programming
matt matt is offline
external usenet poster
 
Posts: 92
Default Showing a list of SQL Tables under ODBC

Hi onedaywhen

Thanks for all your help
Did some searching and ended up with below

Thanks again

Regards

Matt

Went with :

Range("SQL_Database_Name").Select
With Selection.Validation
.Delete
.Add Type:=xlValidateList,
AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:=ListofSQLServerNames
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With





-----Original Message-----
"Matt" wrote ...

Wicked!!
Thanks onedaywhen, that's taught me a lot.


Glad to hear it.

To be a bit cheeky and ask for more? Is there any
way of listing these options so that a user can select
one of them and have it land it a cell?


The are too many ways of doing this to generalize.

A sentence, instead of a Sub which builds a string, make
ListofSQLServerNames a function which returns a string

array:

Public Function ListofSQLServerNames() As Variant

which you can associate the List property of a ComboBox

on a userform
or worksheet e.g.

MyListbox.List = ListofSQLServerNames()

Post some more details for an in-depth answer.

--
.