ok. alex, valeu pelas dicas!
Já havia consultado estes link's, consegui acessar o outro arquivo, mas só consigo carregar as abas e as linhas da coluna A juntas na ListBox ou na ComboBox. Preciso que as abas sejam carregadas no Combobox e ao clicar nome item selecionado (planilha) a lista é carregada com a coluna A daquela aba. segue o codigo:
Private Sub UserForm_Initialize()
Dim ListItems As Variant, i As Integer
Dim SourceWB As Workbook
Dim OSheet As Object
Dim lCount As Long
With Me.ComboBox1
.Clear ' remove existing entries from the listbox
' turn screen updating off,
' prevent the user from seeing the source workbook being opened
Application.ScreenUpdating = False
' open the source workbook as ReadOnly
Set SourceWB = Workbooks.Open("C:UsersLaerteDesktopBD Eng.xls", _
False, True)
ReDim StrSheets(Sheets.Count - 1)
For Each OSheet In Sheets
Let StrSheets(lCount) = OSheet.Name
Let lCount = lCount + 1
Next OSheet
For lCount = LBound(StrSheets) To UBound(StrSheets)
Let Cells(lCount + 1, 1) = StrSheets(lCount)
Next lCount
End With
With Me.ComboBox1
ListItems = SourceWB.Worksheets(1).Range("A2:A21").Value
' get the values you want
SourceWB.Close False ' close the source workbook without saving changes
Set SourceWB = Nothing
Application.ScreenUpdating = True
ListItems = Application.WorksheetFunction.Transpose(ListItems)
' convert values to a vertical array
For i = 1 To UBound(ListItems)
.AddItem ListItems(i) ' populate the listbox
Next i
.ListIndex = -1 ' no items selected, set to 0 to select the first item
End With
End Sub
Obrigado, pela ajuda e compreesão!
Postado : 05/12/2013 9:11 am