Nul en VBA, besoin d'une petite aide pour modifier

A

Alex

Guest
Salut,

J'ai trouvé une petite macro super pratique poue envoyer une page excel ou tout le classeur en 1 petit clic.

La macro est vraiment bien mais un peu trop 'impersonnelle' pour une utilisation au bureau car elle envoie les fichiers sans aucun texte dans le corps de l'email.

Je souhaiterai ajouter (directement ds le code VBA, c'est plus simple) un petit texte standard pour les destinataires des fichiers (ça sera un truc du genre 'veuillez trouver ci-joint .... blablablablablablablabla).

Est ce qu'une âme charitable du forum pourrait jeter un coup d'oeil à cela ?
Il me semble que le code est rattaché aux forms USF1 & USF2.


Merci d'avance



Alex
 
A

Alex

Guest
Bon, je n'arrive pas à joindre le fichier mais voila la partie principale du code VBA (il est en plusieurs parties ds le fichier mais cette partie est de loin la + importante).


Encore merci.

Private Sub CommandButton1_Click()
Dim Arobase As String
Dim Point As String
Dim Vide As Variant
If OptionButton1 = False And OptionButton2 = False Then
MsgBox 'Vous Devez Faire un Choix pour ce que vous désirez envoyer', vbExclamation, USF2.X
Exit Sub
End If
If TextBox1.Value = '' Then
MsgBox 'vous avez oublié de rentrer une adresse'
OptionButton1.Value = False
OptionButton2.Value = False
TextBox1.SetFocus
Exit Sub
End If

MailAdresse = TextBox1

If TextBox2.Value = '' Then
MsgBox 'vous avez oublié de rentrer un objet'
OptionButton1.Value = False
OptionButton2.Value = False
TextBox2.SetFocus
Exit Sub
End If
MailSubject = TextBox2
mailbody = 'test vlkdfhgkjfhgkljhfdkgjdjfghfkgkjghhhhhhhhhhhhhhhhhhhhhhhhhhhh'

On Error GoTo BadMail
Arobase = Application.WorksheetFunction.Search('@', MailAdresse, 1)
Point = Application.WorksheetFunction.Search('.', MailAdresse, 1)

On Error GoTo Suite
Vide = Application.WorksheetFunction.Search(' ', MailAdresse, 1)
Suite:
If Vide <> '' Then GoTo BadMail

If OptionButton1.Value = True Then
Unload Me
USF2.Show
End If

If OptionButton2.Value = True Then
Unload Me
SortirUserForm
End If

Exit Sub
BadMail:
MsgBox 'L'adresse Email ne semble pas valide'
TextBox1.SetFocus
End Sub
 

Statistiques des forums

Discussions
311 715
Messages
2 081 822
Membres
101 821
dernier inscrit
hybroxis