Drop Down List With .txt File Instead Of .xlsx Follow
Hi, First time poster here.
I have a script I got from reading the forums here for a simple drop down list pulled from a file.
FUNCTIONS AND SUBS: dim objConn dim strConn dim rs strConn = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source='c:\Database\ingredients.xlsx';Extended Properties=""Excel 12.0 Xml;HDR=YES;IMEX=1;""" Public Function GetNames() Dim strNames Set objConn = CreateObject("ADODB.Connection") objConn.Open strConn Set rs = CreateObject("ADODB.Recordset") Set rs = objConn.Execute("SELECT * FROM [Sheet1$]") strNames = "" rs.MoveFirst() do while NOT rs.EOF strNames = strNames + rs.fields("Ingredients") + vbCrLf rs.MoveNext() loop GetNames = strNames End Function
ONFILLLIST Value = GetNames()
While it works perfectly, I would like to have it pull from a txt file instead.
I am completely lost as to how this is to be accomplished.
Thank you for your time!
Please sign in to leave a comment.