Professional Documents
Culture Documents
'func.Close
'banco.Close
'String de conexão para a planilha. estou usando o MS Office 2013. Para outras versões de
'introdução SQL que retorna os campos classificado em ordem alfabética por unidade
'Exemplos de possibilidades:
strSQL = "SELECT UNIDADE, CARGO, MATRICULA, NOME, SALARIO " & "FROM [Base$A:E]
Order by unidade"
'Abrimos a conexão
banco.Open conStr
'Mensagem de texto
MSGBOX func.RecordCount
Me.TextTotal = func.RecordCount
'Mostrando dados
TxtMatricula = func!matricula
TxtNome = func!nome
TxtCargo = func!cargo
TxtSalario = func!salario
TxtUnidade = func!unidade
End Sub
End
End If
End Sub
Sheets.Add after:=ActiveSheet
ActiveSheet.Name = "Teste"
End Sub
Sheets("Teste").Select
ActiveCell.Offset(0, 0) = "Jefferson"
ActiveCell.Offset(1, 0) = "Maria"
'Range("A1:B6).Select
End Sub
Sheets("Teste").Select
ActiveCell.Offset(0, 0) = func!unidade
ActiveCell.Offset(0, 1) = func!cargo
ActiveCell.Offset(0, 2) = func!matricula
ActiveCell.Offset(0, 3) = func!nome
ActiveCell.Offset(0, 4) = func!salario
Range("a1000").End(xlUp).Offset(1, 0).Select
End Sub
Sheets("Teste2").Select
End Sub
Sheets.Add after:=ActiveSheet
ActiveSheet.Name = func!unidade
Range("A1").Select
linha = 1
Setor = ""
Setor = func!unidade
Cells(linha, 1) = func!unidade
Cells(linha, 2) = func!cargo
Cells(linha, 3) = func!matricula
Cells(linha, 4) = func!nome
Cells(linha, 5) = func!salario
linha = linha + 1
func.MoveNext
If func.EOF Then
Exit Sub
End If
Loop
Sheets.Add after:=ActiveSheet
ActiveSheet.Name = func!unidade
Range("A1").Select
linha = 1
Loop