how to center logo in html code

sspreyer

Registered User.
Local time
Yesterday, 19:59
Joined
Nov 18, 2013
Messages
251
how to center logo in html code in vba

hi, all

I'm try to centre a logo image in the middle of email but I having issue doing it doesn't seem to matter what I try I can't seem to get it to do what I want . The code below works but doesn't centre the image


here the code :
Code:
Dim txtLogoURL As String        'this is for your logo
    
   txtLogoURL = "C:\Users\Dell\Pictures\oie_transparent.png"
 strHTML = strHTML & "<p>"
 strHTML = strHTML & "<a href=""[URL]http://www.testing.com/""><img[/URL] border=""0"" src=" _
    & txtLogoURL & "' [COLOR=red][B]align='Centre'[/B][/COLOR] width =200" & " alt=""testing"" /></a>"
thanks in advance
shane
 
Last edited:
You should put the align attribute on the <p> tag, not the <a> tag. Also, not to sound like an ignorant american (not that I am not one), but I think it has to be 'center'
 
Last edited:
hi, plog

I tried what you have said doesn't make any difference

Code:
   Dim txtLogoURL As String        'this is for your logo
    
   txtLogoURL = "C:\Users\Dell\Pictures\oie_transparent.png"
 strHTML = [COLOR=red]strHTML & "<p' align='center'>"[/COLOR]
 strHTML = strHTML & "<a href=""[URL]http://www.testing.com/""><img[/URL] border=""0"" src=" _
    & txtLogoURL & " alt=""testing"" /></a>"

thanks in advance

shane
 
Code:
strHTML = strHTML & "<p' align='center'>"

You have an unmatched single quote after the p.
 
Code:
 strHTML = strHTML & "<a href=""http://www.testing.com/""><img border=""0"" src=" _
    & txtLogoURL & " alt=""testing"" /></a>"

Sort of related. You need a double quote to appear in the HTML before and after the src attribute value--which means putting double double quotes in your VBA .

...src="""_ & txtLogoUrl & """ alt...
 
thanks!!! plog what a silly mistake :banghead:


thanks again

shane
 
]Sort of related. You need a double quote to appear in the HTML before and after the src attribute value--which means putting double double quotes in your VBA .

...src="""_ & txtLogoUrl & """ alt...


Thanks again Plog I have made the change :D
 

Users who are viewing this thread

Back
Top Bottom