problème webbrowser

titange305

XLDnaute Nouveau
bonjour,

J'ai rechercher et j'ai trouver ceci sur le forum c'est la demo webbrowserdemo
quand j'exécute le programme il me dit que j'ai une erreur 91 mais quand je l'exécute en pas a pas cela fonctionne

je ne trouve pas la solution

si quelqu'un a deja eu ce genre de problème et qu'il pourrait m'aider

merci à vous
 

titange305

XLDnaute Nouveau
Re : problème webbrowser

je viens de trouver enfin lol

mais j'ai une question:

comment peut on centrer une image avec cette méthode:
Sub userform initialize
Gif = ThisWorkbook.Path & "\Test.gif" 'si le fichier Gif est dans le meme repertoire que le classeur
WebBrowser1.Navigate Gif
end sub

sub activate
WebBrowser1.Document.body.Style.BorderStyle = "outset"
WebBrowser1.Document.body.Style.BorderColor = "purple"
WebBrowser1.Document.body.Style.borderwidth = "thin"
WebBrowser1.Document.body.ScrollTop = 0
WebBrowser1.Document.body.ScrollLeft = 0
WebBrowser1.Document.body.Style.overflow = "hidden"
WebBrowser1.Document.body.Style.overflowX = "hidden"
WebBrowser1.Document.body.Style.overflowY = "hidden"
WebBrowser1.Document.body.TopMargin = 0
WebBrowser1.Document.body.BottomMargin = 0
WebBrowser1.Document.body.LeftMargin = 0
WebBrowser1.Document.body.RightMargin = 0
end sub

en jouant sur le left et le top mais comment calculer
je ne vois pas du tout

merci
 

myDearFriend!

XLDnaute Barbatruc
Re : problème webbrowser

Bonsoir titange305, Pierrot93,

Si j'ai bien compris l'objectif...

Code:
[SIZE=2][COLOR=GRAY][B][I]DANS LE MODULE DE CODE DU USERFORM[/I][/B][/COLOR]

[COLOR=NAVY]Private Sub[/COLOR] UserForm_Initialize()
[COLOR=NAVY]Dim[/COLOR] ImgGif [COLOR=NAVY]As String[/COLOR], DocGif [COLOR=NAVY]As String[/COLOR]

    ImgGif = ThisWorkbook.Path & "\Test.gif" [COLOR=GREEN]'si le fichier Gif est dans le meme repertoire que le classeur[/COLOR]
    
    DocGif = "about:<html><body><table border=0 width=100% height=100%><tr>" _
        & "<td align='center' valign='middle'><img src='" _
        & ImgGif _
        & "'></td></tr></table></body></html>"
    
    WebBrowser1.Navigate DocGif
[COLOR=NAVY]End Sub[/COLOR][/SIZE]
Cordialement,