IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Macros et VBA Excel Discussion :

espace entre ligne code html pour VBA


Sujet :

Macros et VBA Excel

  1. #1
    Membre éclairé
    Avatar de tamtam64
    Homme Profil pro
    stagiaire developpement vba
    Inscrit en
    Mai 2012
    Messages
    456
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Hauts de Seine (Île de France)

    Informations professionnelles :
    Activité : stagiaire developpement vba
    Secteur : Finance

    Informations forums :
    Inscription : Mai 2012
    Messages : 456
    Points : 658
    Points
    658
    Billets dans le blog
    17
    Par défaut espace entre ligne code html pour VBA
    Bonjour,

    J'ai consulé internet et je ne trouve pas la réponse à ma question :
    J'ai créé un email en VBA, généré par excel. mais quand on veut rajouter un commentaire sur l'email, l'espace entre les lignes est tres important , je voudrais resserer les lignes, cela vient probablement du fait que l'email est en html, j'aimerais trouver une solution en evitant d'utiliser du css ( en admetant qu'on puisse) sinon avec css directement ds le code eventuellement

    Merci d'avance , si vous voulez mon code je peut le fournir.

  2. #2
    Expert éminent

    Homme Profil pro
    Curieux
    Inscrit en
    Juillet 2012
    Messages
    5 139
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Curieux
    Secteur : Arts - Culture

    Informations forums :
    Inscription : Juillet 2012
    Messages : 5 139
    Points : 9 974
    Points
    9 974
    Billets dans le blog
    5
    Par défaut
    Bonjour,

    ne sachant si on est dans le cadre d'une automation stricte ou pas, c'est effectivement difficile de t'orienter sans voir le code.

  3. #3
    Membre éclairé
    Avatar de tamtam64
    Homme Profil pro
    stagiaire developpement vba
    Inscrit en
    Mai 2012
    Messages
    456
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Hauts de Seine (Île de France)

    Informations professionnelles :
    Activité : stagiaire developpement vba
    Secteur : Finance

    Informations forums :
    Inscription : Mai 2012
    Messages : 456
    Points : 658
    Points
    658
    Billets dans le blog
    17
    Par défaut
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
            'creation Mail
        Set OutApp = CreateObject("outlook.application")
        Set OutMail = OutApp.CreateItem(olMailItem)
     
        With OutMail
            .To = ""
            '.CC = ""
            '.BCC = ""
            .Subject = "Rates: P&L & VAR and breaches as of " & Format(Date_Repor, "dd/mm/yyyy")
     
                    .Attachments.Add PathTmp & Img, olByValue, 0
                    .Attachments.Add chemin & "\" & graph1, olByValue, 0
                    .Attachments.Add chemin & "\" & graph2, olByValue, 0
                    .Attachments.Add PathTmp & Img2, olByValue, 0
                    .Attachments.Add PathTmp & Img3, olByValue, 0
                    .Attachments.Add chemin & "\" & graph3, olByValue, 0
                    .Attachments.Add PathTmp & Img8, olByValue, 0
                    .Attachments.Add PathTmp & Img5, olByValue, 0
                    .Attachments.Add PathTmp & Img6, olByValue, 0
     
                'Body du mail en html
            .HTMLBody = "<span LANG=FR><p class=style2>" _
                & "<font FACE=Arial  SIZE=2>Hello," _
                & "<br>" & "<br>" & "<br>" & "Please find below a summary of the Rates product line of " _
                & Format(Date_Repor, "dd/mm/yyyy") & "<br><br>" _
                & "<font FACE=Arial  SIZE=2> <strong> 1) P&L </strong>" & "<br>" & "<br>" & "<br>" _
                & "<img src='cid:" & Img & "'</font></span>" & "<br>" & "<br>" & "<br>" _
                & "<img src='cid:" & graph1 & "'</font></span>" & "   " & "<img src='cid:" & graph2 & "'</font></span>" & "<br>" & "<br>" & "<br>" _
                & "<font FACE=Arial  SIZE=2> <strong> 2) P&L explanation </strong>" & "<br>" & "<br>" & "<br>" & "<img src='cid:" & Img2 & "'</font></span>" & "<br>" & "<br>" & "<br>" _
                & "<font FACE=Arial  SIZE=2> <strong> 3) VAR & worst scenarios </strong>" & "<br>" & "<br>" & "<br>" & "<img src='cid:" & Img3 & "'</font></span>" _
                & "<br>" & "<br>" & "<br>" & "<img src='cid:" & Img8 & "'</font></span>" _
                & "<br>" & "<br>" & "<br>" & "<img src='cid:" & graph3 & "'</font></span>" & "<br> <font FACE=Arial  SIZE=1> An Add-on has been added to the VAR computation for Liquid bonds perimeter starting 15/06/2015. " & "<br>" & "<br>" _
                & "<br>" & "<br>" & "<br>" & "<font FACE=Arial  SIZE=2> <strong> 4) VAR Backtesting </strong>" & "<br>" & "<br>" & "<br>" _
                & resBack & "<br>" & "<br>" & "<br>" _
                & "<font FACE=Arial  SIZE=2> <strong> 5) Contribution to CACIB VAR </strong>" & "<br>" & "<br>" & "<br>" & "<img src='cid:" & Img5 & "'</font></span>" & "<br>" & "<br>" & "<br>" _
                & "<font FACE=Arial  SIZE=2> <strong> 6) Stressed VAR </strong>" & "<br>" & "<br>" & "<br>" & "<img src='cid:" & Img6 & "'</font></span>" & "<br> <font FACE=Arial  SIZE=1> Note: Limits are for VAR only (no limit on Stressed VAR)</font></span>" & "<br>" & "<br>" _
                & "<font FACE=Arial  SIZE=2> <strong> "
     
            .Display
        End With
     
            'Vidage
        Set OutMail = Nothing
        Set OutApp = Nothing
        Kill PathTmp & Img
    voici une partie du code merci d'avance car je vois pas du tt comment faire

  4. #4
    Expert éminent

    Homme Profil pro
    Curieux
    Inscrit en
    Juillet 2012
    Messages
    5 139
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Curieux
    Secteur : Arts - Culture

    Informations forums :
    Inscription : Juillet 2012
    Messages : 5 139
    Points : 9 974
    Points
    9 974
    Billets dans le blog
    5
    Par défaut
    Ok, j'ai deux hypothèses, la bonne se vérifiera quand j'aurai généré le mail.

    je regarde ça quand je récupère un client outlook, vers 1h du mat', pour tester ton code .. j'ai un gros programme qui y tourne actuellement.

    mais peut être que quelqu'un t'auras déjà répondu d'ici là

    accessoirement, tu veux l'insérer à quel endroit ton commentaire ?

  5. #5
    Membre éclairé
    Avatar de tamtam64
    Homme Profil pro
    stagiaire developpement vba
    Inscrit en
    Mai 2012
    Messages
    456
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Hauts de Seine (Île de France)

    Informations professionnelles :
    Activité : stagiaire developpement vba
    Secteur : Finance

    Informations forums :
    Inscription : Mai 2012
    Messages : 456
    Points : 658
    Points
    658
    Billets dans le blog
    17
    Par défaut
    Alors deja c'est super sympa , et a mon avis a apart certain comme toi je ne pense pas que la question trouvera preneur ce soir
    donc j'attendrais de tte facon je dois coder un tit truc ce soir donc je serais réveillé.
    Alors pour le commentaire que je veux rentrer a la main, ca serais "please find.... etc "
    pour pouvoir renseigner une analyse ou comme ca et pas avoir les lignes avec un tel ecart ..
    Merci

  6. #6
    Expert éminent

    Homme Profil pro
    Curieux
    Inscrit en
    Juillet 2012
    Messages
    5 139
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Curieux
    Secteur : Arts - Culture

    Informations forums :
    Inscription : Juillet 2012
    Messages : 5 139
    Points : 9 974
    Points
    9 974
    Billets dans le blog
    5
    Par défaut
    Bonjour,

    désolé pour hier ... plantage d'un gros programme, et mode correction jusque 5h


    l'écart important quand tu ajoutes un commentaire à la main provient, comme je le pensais, du Style appliqué dans ton mail.

    t'as deux solutions :

    1) avant d'ajouter ton commentaire, tu vas dans l'onglet "Format du Texte" >> sous-onglet "Style" et tu sélectionnes le style normal ou sans interligne
    2) tu ne formates pas avec le style actuellement utilisédans ton HTMLBody, mais tu perds probablement la présentation que tu as pensé.


    je suis pas assez calé en HTML pour te proposer une modification qui puisse restaurer le style normal après Display de ton mail

  7. #7
    Invité
    Invité(e)
    Par défaut
    Bonjour,
    <br> veut dire retour chariot et tu en as une palanqué!
    "<br>" & "<br>" ne rime à rien!
    "<br><br>" là on es bon
    Essais comme ça
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     bdy="<P>ceci est ma première ligne </P>"
    Bdy =bdy & "<p>ceci est ma dixième ligne </p>"
    Tu disais que tu ne voulais pas de css mais class=style2 fait référence à un css! (css par défaut)

    En revanche tu peut créer les classe de style dans ton html!

    Je ne sais pas ce qui t'a inspiré ce code HTML mais il est tordu!

    Apprends à utiliser les balise <Div>

    La mayeur mise en page ce fait avec des tableaux
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    <table>
    <tr>
    <td>A</td><td>B</td>
    </tr><tr>
    <td>A1</td><td>B1</td>
    </tr>
    </table>
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    .HTMLBody = "<span LANG=FR><p class=style2>" _
    & "<font FACE=Arial SIZE=2>Hello," _
    & "<P>Please find below a summary of the Rates product line of " _
    & Format(Date_Repor, "dd/mm/yyyy") & "</P>" _
    & "<font FACE=Arial SIZE=2> <strong> <P>1) P&L</P></strong>" _
    & "<P><img src='cid:" & Img & "'></P></font></span>" _
    & "<P><img src='cid:" & graph1 & "'></P></font></span><P><img src='cid:" & graph2 & "'></P></font></span>" _
    & "<font FACE=Arial SIZE=2> <strong> 2)<P> P&L explanation </P></strong><P><img src='cid:" & Img2 & "'></P></font></span>" _
    & "<font FACE=Arial SIZE=2> <strong> 3) VAR & worst scenarios </strong><P><img src='cid:" & Img3 & "'></P></font></span>" _
    & "<P><img src='cid:" & Img8 & "'></P></font></span>" _
    & "<P><img src='cid:" & graph3 & "'></P></font></span><font FACE=Arial SIZE=1> <P>An Add-on has been added to the VAR computation for Liquid bonds perimeter starting 15/06/2015.</P>" _
    & "<font FACE=Arial SIZE=2> <strong><P> 4) VAR Backtesting </strong></P>" _
    & "<P>" & resBack & "</P>" _
    & "<font FACE=Arial SIZE=2> <strong><P> 5) Contribution to CACIB VAR </P></strong><P><img src='cid:" & Img5 & "'></P></font></span>" _
    & "<font FACE=Arial SIZE=2> <strong><P> 6) Stressed VAR</P> </strong><P><img src='cid:" & Img6 & "'></P></font></span><font FACE=Arial SIZE=1> <P>Note: Limits are for VAR only (no limit on Stressed VAR)</P></font></span>" _
    & "<font FACE=Arial SIZE=2> <strong> "
    Dernière modification par Invité ; 22/07/2015 à 13h12.

Discussions similaires

  1. Code Html pour lien URL
    Par nettoyerforum dans le forum Balisage (X)HTML et validation W3C
    Réponses: 7
    Dernier message: 15/06/2007, 09h42
  2. Code html pour lancer script PHP
    Par Luxeon26 dans le forum Langage
    Réponses: 7
    Dernier message: 24/02/2007, 16h59
  3. Suppression espace entre ligne d'un tableau
    Par Alain15 dans le forum Balisage (X)HTML et validation W3C
    Réponses: 2
    Dernier message: 17/08/2006, 12h04
  4. code HTML pour mettre une image en background dans un menu
    Par Link14 dans le forum Balisage (X)HTML et validation W3C
    Réponses: 2
    Dernier message: 16/10/2005, 12h11
  5. Réponses: 2
    Dernier message: 24/04/2005, 13h17

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo