Hallo,
Ik heb een kort vraagje. Ik heb een simpel invulformulier gemaakt dan automatisch gemaild wordt naar onze administratie. Alleen bij het testen kom ik erachter dat de data niet altijd correct verzonden wordt, ik denk omdat de opgeslagen data niet goed overschreven wordt? Hoe kan ik mijn VBA code zo inrichten dat altijd de ingevulde data op R2 terecht komt en daarna verzonden? Hieronder mijn code:
Gr. Boukje
Private Sub CommandButton1_Click()
Dim Rij As Integer
Dim wb As Workbook
Dim sht As Worksheet
Set sht = ThisWorkbook.Sheets("Blad1")
Rij = 2
'werkboek.sheet.cells
sht.Cells(Rij, 1) = Me.LBVestiging
sht.Cells(Rij, 2) = Me.TBEigennaam
sht.Cells(Rij, 3) = Me.TBVoornaam
sht.Cells(Rij, 4) = Me.TBachternaam
sht.Cells(Rij, 5) = Me.TBpersoneelsnummer
sht.Cells(Rij, 6) = Me.TBFunctie
sht.Cells(Rij, 7) = Me.TBOpmerking
sht.Cells(Rij, 8) = Me.Aanzegging
sht.Cells(Rij, 9) = Me.Uitdienst
sht.Cells(Rij, 10) = Me.Laatst
sht.Cells(Rij, 11) = Me.Opinitiatiefvan
sht.Cells(Rij, 12) = Me.Redenuitdienst
sht.Cells(Rij, 13) = Me.Vertrekgoedgevoel
sht.Cells(Rij, 14) = Me.TBdatum
For Each vak In Me.Controls
If TypeName(vak) = "TextBox" Or TypeName(vak) = "ComboBox" Then
vak.Value = ("")
End If
Next
With CreateObject("Outlook.Application").createitem(0)
.to = "bnauta@compananny.nl"
.Subject = "PA Formulier - Melding uitdienst"
.attachments.Add ThisWorkbook.FullName
.Send
End With
MsgBox ("Jouw gegevens zijn verzonden naar de Personeelsadministrateur")
End Sub
Ik heb een kort vraagje. Ik heb een simpel invulformulier gemaakt dan automatisch gemaild wordt naar onze administratie. Alleen bij het testen kom ik erachter dat de data niet altijd correct verzonden wordt, ik denk omdat de opgeslagen data niet goed overschreven wordt? Hoe kan ik mijn VBA code zo inrichten dat altijd de ingevulde data op R2 terecht komt en daarna verzonden? Hieronder mijn code:
Gr. Boukje
Private Sub CommandButton1_Click()
Dim Rij As Integer
Dim wb As Workbook
Dim sht As Worksheet
Set sht = ThisWorkbook.Sheets("Blad1")
Rij = 2
'werkboek.sheet.cells
sht.Cells(Rij, 1) = Me.LBVestiging
sht.Cells(Rij, 2) = Me.TBEigennaam
sht.Cells(Rij, 3) = Me.TBVoornaam
sht.Cells(Rij, 4) = Me.TBachternaam
sht.Cells(Rij, 5) = Me.TBpersoneelsnummer
sht.Cells(Rij, 6) = Me.TBFunctie
sht.Cells(Rij, 7) = Me.TBOpmerking
sht.Cells(Rij, 8) = Me.Aanzegging
sht.Cells(Rij, 9) = Me.Uitdienst
sht.Cells(Rij, 10) = Me.Laatst
sht.Cells(Rij, 11) = Me.Opinitiatiefvan
sht.Cells(Rij, 12) = Me.Redenuitdienst
sht.Cells(Rij, 13) = Me.Vertrekgoedgevoel
sht.Cells(Rij, 14) = Me.TBdatum
For Each vak In Me.Controls
If TypeName(vak) = "TextBox" Or TypeName(vak) = "ComboBox" Then
vak.Value = ("")
End If
Next
With CreateObject("Outlook.Application").createitem(0)
.to = "bnauta@compananny.nl"
.Subject = "PA Formulier - Melding uitdienst"
.attachments.Add ThisWorkbook.FullName
.Send
End With
MsgBox ("Jouw gegevens zijn verzonden naar de Personeelsadministrateur")
End Sub