Formulários - cadastro não salva
Enviado: Qua Jan 09, 2019 2:59 pm
Muito bom a tarde...estou como problemas para finalizar meu formulário...a planilha não salva...já tentei alguns códigos mas nenhum funciona...preciso de ajuda...como faço para enviar a planilha?
Private Sub cmdSalvar_Click()
If Me.EnableEvents = False Then Exit Sub
If inserir_novalinha = True Then
Set registro = tabela.ListRows.Add(tabela.Range.Rows.Count, False)
Else
Set registro = tabela.ListRows(Me.Lançamentos.ListIndex + 1)
End If
Me.EnableEvents = False
With registro
.Range(1, 1) = ComboBoxOrigem.Value
.Range(1, 2) = ComboBoxAno.Value
.Range(1, 3) = ComboBoxMês.Value
.Range(1, 4) = ComboBoxMinistério.Value
.Range(1, 5) = ComboBoxConta.Value
.Range(1, 6) = ComboBoxRubrica.Value
.Range(1, 7) = TextBoxDescrição.Text
.Range(1, 8) = txtData.Text
.Range(1, 9) = ComboBoxTipoDocumento.Text
.Range(1, 10) = TextBoxNdocumento.Text
.Range(1, 11) = TextBoxValor.Text
End With
Me.EnableEvents = True
Call limparCampos
Set registro = Nothing
ThisWorkbook.Save
End Sub
Private Sub cmdSalvar_Click()
If Me.EnableEvents = False Then Exit Sub
If inserir_novalinha = True Then
Set registro = tabela.ListRows.Add(tabela.Range.Rows.Count, False)
Else
Set registro = tabela.ListRows(Me.Lançamentos.ListIndex + 1)
End If
Me.EnableEvents = False
With registro
.Range(1, 1) = ComboBoxOrigem.Value
.Range(1, 2) = ComboBoxAno.Value
.Range(1, 3) = ComboBoxMês.Value
.Range(1, 4) = ComboBoxMinistério.Value
.Range(1, 5) = ComboBoxConta.Value
.Range(1, 6) = ComboBoxRubrica.Value
.Range(1, 7) = TextBoxDescrição.Text
.Range(1, 8) = txtData.Text
.Range(1, 9) = ComboBoxTipoDocumento.Text
.Range(1, 10) = TextBoxNdocumento.Text
.Range(1, 11) = TextBoxValor.Text
End With
Me.EnableEvents = True
Call limparCampos
Set registro = Nothing
ThisWorkbook.Save
End Sub