Ik heb een formulier gemaakt in word, als ik deze invul heb ik onder aan het formulier een cmb welke het ingevulde formulier moet verzenden.
echter wordt de laatste opgeslagen formulier opgestuurd.
wat doe ik fout, of moet ik aanpassen?
kan iemand mij hiermee helpen?
Gr. Rkootje
echter wordt de laatste opgeslagen formulier opgestuurd.
wat doe ik fout, of moet ik aanpassen?
kan iemand mij hiermee helpen?
Gr. Rkootje
Code:
Private Sub CommandButton1_Click()
' Works in Excel 2000, Excel 2002, Excel 2003, Excel 2007, Excel 2010, Outlook 2000, Outlook 2002, Outlook 2003, Outlook 2007, Outlook 2010.
Dim OutApp As Object
Dim OutMail As Object
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
If TextBox1 = "" Then
MsgBox "vul eigen naam in svp"
Me.TextBox1.Activate
ElseIf txtDatum = "" Then
MsgBox "vul Datum in svp"
Me.txtDatum.Activate
ElseIf txtonderwerp = "" Then
MsgBox "Vul onderwerp in svp"
Me.txtonderwerp.Activate
ElseIf txtadres = "" Then
MsgBox "vul adres in svp"
Me.txtadres.Activate
ElseIf TextBox2 = "" Then
MsgBox "vul aanvullende gegevens in svp"
Me.TextBox2.Activate
Else
On Error Resume Next
' Change the mail address and subject in the macro before you run it.
With OutMail
.To = "rkootje@test.nl"
.CC = ""
.BCC = ""
.Subject = Me.txtadres
.Body = "Aanvraag woondiensten"
.Attachments.Add ActiveDocument.FullName
' You can add other files by uncommenting the following line.
'.Attachments.Add ("C:\test.txt")
' In place of the following statement, you can use ".Display" to
' display the mail.
.Send
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End If
End Sub
Laatst bewerkt: