
O que será que esta errado no meu codigo fonte?
Codigo da minha tela de CadastroEscola
**************************************************
Private Sub ImpExcel()
Dim xlWorkSheet As Excel.Worksheet
'Dim dataAtual As Date
'Dim dataNasc As Date
Dim xl As New Excel.Application
Dim xlw As Excel.Workbook
Dim idade As Long
'Abrir o arquivo do Excel
Set xlw = xl.Workbooks.Open(Application.GetOpenFilename(fileFilter:="xls Files (*.xls), *.xls"))
'xlWorkSheet = xlw.Worksheets("Plan1")
'Definir qual a planilha de trabalho
xlw.Sheets("Plan1").Select
'Exibe o conteúdo da célula na posição 2,3
' variavel = xlw.Application.Cells(2, 3).Value
'MsgBox xlw.Application.Worksheets(1).txtNome.Text
'dataAtual = Now.Date
'dataNasc = Parse.Date(txtNascimento.Text)
'Preenche os TextBox do formulário a partir dos dados do arquivo excel importado
TextBox5.Text = xlw.Application.Worksheets(1).TextBox1.Text
TextBox6.Text = xlw.Application.Worksheets(1).TextBox2.Text
TextBox8.Text = xlw.Application.Worksheets(1).TextBox4.Text
TextBox1.Text = xlw.Application.Worksheets(1).TextBox5.Text
TextBox7.Text = 2011 - (Mid(xlw.Application.Worksheets(1).TextBox3.Text, 7, 10))
' Image2.Picture = xlw.Application.Workbooks(1).Image1.Picture
'Image2.Picture = LoadPicture(xlw.Application.Worksheets(1).Image1)
'Image2.Picture = xlw.Application.Worksheets(1).Image1.Text ' aaaaaa
' Fechar a planilha sem salvar alterações
' Para salvar mude False para True
xlw.Close False
' Liberamos a memória
Set xlw = Nothing
Set xl = Nothing
End Sub
Private Sub CommandButton12_Click()
ImpExcel
End Sub
'Private Sub CommandButton1_Click()
Private Sub CommandButton_Seleciona_Click()
Exibe_Caixa_Dialogo
End Sub
End Sub
Private Sub CommandButton_Click()
Exibe_Caixa_Dialogo
End Sub
****************************************************************
Codigo da minha tela CadastroAluno
****************************************************************
Private Sub CommandButton_Seleciona_Click()
Exibe_Caixa_Dialogo
End Sub
Sub Exibe_Caixa_Dialogo()
Set CaixaDialogo = Application.FileDialog(msoFileDialogFilePicker)
With CaixaDialogo
.Title = "wilherme"
.InitialView = msoFileDialogViewPreview
.AllowMultiSelect = False
If .Show = -1 Then
EnderecoImagem = .SelectedItems(1)
Image1.Picture = LoadPicture(.SelectedItems(1))
End If
End With
End Sub
Private Sub CommandButton1_Click()
ActiveWorkbook.Save
End Sub
Private Sub CommandButton5_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = 9 Then
TextBox2.Activate
End If
End Sub
Private Sub Image1_Click()
End Sub
Private Sub Label1_Click()
End Sub
'Private Sub CommandButton4_Click()
Private Sub UserForm1_Initialize()
AtualizaListaEstados
CadastroCodigo = Dados.Range("CodCalc").Value + 1
TextBox_Codigo.Value = CadastroCodigo
AtualizaComboBoxPesquisa
End Sub
Private Sub CommandButton5_Click()
End
End Sub
Private Sub TextBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = 9 Then
TextBox2.Activate
End If
End Sub
Private Sub TextBox2_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = 9 Then
TextBox3.Activate
End If
End Sub
Private Sub TextBox3_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = 9 Then
TextBox4.Activate
End If
End Sub
Private Sub TextBox4_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = 9 Then
TextBox5.Activate
End If
End Sub
Private Sub TextBox5_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = 9 Then
CommandButton1.Activate
End If
End Sub
***********************************************************************