Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
This is my code, when i try to add a xlValidateList in an excel sheet
i receive a run time error 1004 application defined or object defined error ... I tried also to add other lists or formula inside that sheet, it's possible i've to add something in my project (mmm ...) ?? Private Sub CommandButton1_Click() Dim cn As ADODB.Connection Dim rs As ADODB.Recordset Dim Foglio1 As Worksheet Dim PathDataBase As String Dim list As String 'Store the path of the database PathDataBase = Sheets("Foglio1").Range("E2").Value ' connect to the Access database Set cn = New ADODB.Connection cn.Open "Provider=Microsoft.Jet.OLEDB.4.0; " & _ "Data Source=" & PathDataBase & ";" 'now find in tblCostruttori and replace in the table Set rs = New ADODB.Recordset rs.Open "tblCostruttori", cn, adOpenKeyset, adLockOptimistic, adCmdTable lunghezza = rs.RecordCount lista = "" Do While (Not rs.EOF) list = list & rs.Fields("Costruttori") & ";" rs.MoveNext Loop rs.Close Set rs = Nothing With Sheets("Foglio1").Range("C2").Validation .Delete .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _ xlBetween, Formula1:=list .IgnoreBlank = True .InCellDropdown = True .InputTitle = "" .ErrorTitle = "" .InputMessage = "" .ErrorMessage = "" .ShowInput = True .ShowError = True End With |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]() Which line does the macro get stuck on? -- mrice Research Scientist with many years of spreadsheet development experience ------------------------------------------------------------------------ mrice's Profile: http://www.excelforum.com/member.php...o&userid=10931 View this thread: http://www.excelforum.com/showthread...hreadid=559840 |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]() Which line does the macro get stuck on? -- mrice Research Scientist with many years of spreadsheet development experience ------------------------------------------------------------------------ mrice's Profile: http://www.excelforum.com/member.php...o&userid=10931 View this thread: http://www.excelforum.com/showthread...hreadid=559840 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Problem with calculating time | Excel Discussion (Misc queries) | |||
Ugh..another time and date problem...HELP | Excel Worksheet Functions | |||
User Defined Variables in MS query cause a problem to import data | Excel Discussion (Misc queries) | |||
Defined range problem | Excel Discussion (Misc queries) | |||
Problem with time calc | Excel Worksheet Functions |