Option Explicit Sub ImportLayersFromExcel ' Declare variables and constants Const xlDown = -4121 Dim sFileName, aNames(), sName Dim oExcel, oSheet, nRow, nRowCount ' Get the name of the file to import sFileName = Rhino.OpenFileName("Select File", "Excel Files (*.xls, *.xlsx)|*.xls;*.xlsx||") If IsNull(sFileName) Then Exit Sub ' Launch Excel and open the specified file Set oExcel = CreateObject("Excel.Application") oExcel.Workbooks.Open(sFileName) ' Get the active worksheet Set oSheet = oExcel.ActiveSheet ' Count the number of rows that need to be processed nRowCount = oSheet.Range("a1", oSheet.Range("a1").End(xlDown)).Rows.Count If (nRowCount = 0 ) Then Rhino.Print "No data range found in file." Exit Sub End If ' Re-dimension the resulting array ReDim aNames(nRowCount-1) ' Process all rows Rhino.Print "Importing data..." For nRow = 1 To nRowCount ' Read the values from columns A sName = oSheet.Cells(nRow, 1).Value If IsString(sName) Then aNames(nRow - 1) = sName End If Next ' Close Excel and disassociate object variables oExcel.Quit Set oSheet = Nothing Set oExcel = Nothing ' Add layers Call Rhino.EnableRedraw(False) For Each sName In aNames Call Rhino.AddLayer(sName) Next Call Rhino.EnableRedraw(True) End Sub Function IsString(ByVal str) IsString = False If VarType(str) = vbString Then IsString = True End Function Call Rhino.AddStartupScript(Rhino.LastLoadedScriptFile) Call Rhino.AddAlias("ImportLayersFromExcel", "_NoEcho _-RunScript (ImportLayersFromExcel)")