+ Reply to Thread
Results 1 to 4 of 4

Problem with HTML in UserForm WebBrowser

  1. #1
    Registered User
    Join Date
    12-13-2013
    Location
    Espoo, Finland
    MS-Off Ver
    Excel 2007
    Posts
    14

    Problem with HTML in UserForm WebBrowser

    Hi guys,

    I have developed some code that generates a short HTML file, this file is then navigated to in a WebBrowser object in a UserForm in my project. The aim is to get a small icon from the web to display in the exact centre of the browser object. The code I have got works great if I open the HTML file in Chrome or IE, but for some reason it doesn't work right in the WebBrowser object.

    The problem is that the image shows in the top-left of the object, rather than in the middle. This is the code at the moment, I welcome you to test it with an external web browser (IE, Chrome) and with an Excel WebBrowser to see the difference for yourself.

    Please Login or Register  to view this content.
    Thanks for any help you can provide me as to why this won't work in Excel.

  2. #2
    Registered User
    Join Date
    12-13-2013
    Location
    Espoo, Finland
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Problem with HTML in UserForm WebBrowser

    Any help on this one?

  3. #3
    Registered User
    Join Date
    04-16-2014
    Location
    Delhi
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: Problem with HTML in UserForm WebBrowser

    <!DOCTYPE html>
    <body scroll='no'>
    <div style="position: center; top: 0px; left: 0px; width: 100%; height: 100%">
    <img src="http://gatherer.wizards.com/Handlers/Image.ashx?type=symbol&set=nph&size=medium&rarity=M" style="position: absolute; margin: auto; top: 0px; left: 0px; right: 0px; bottom: 0px"/>
    </div>
    </body>
    </html>

  4. #4
    Registered User
    Join Date
    04-16-2014
    Location
    Delhi
    MS-Off Ver
    Excel 2007
    Posts
    2

    Lightbulb Re: Problem with HTML in UserForm WebBrowser

    <!DOCTYPE html>
    <body scroll='no'>
    <div style="position: center; top: 0px; left: 0px; width: 100%; height: 100%">
    <img src="http://gatherer.wizards.com/Handlers/Image.ashx?type=symbol&set=nph&size=medium&rarity=M" style="position: absolute; margin: auto; top: 0px; left: 0px; right: 0px; bottom: 0px"/>
    </div>
    </body>
    </html>

  5. #5
    Registered User
    Join Date
    12-13-2013
    Location
    Espoo, Finland
    MS-Off Ver
    Excel 2007
    Posts
    14

    Re: Problem with HTML in UserForm WebBrowser

    Hey simakarn, I tried your code and it works great in IE/Chrome but for some reason it still doesn't work in my WebBrowser object on my UserForm - the image still shows in the top-left corner of the frame any ideas?

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Getting html document of a webbrowser/SHDocVw.InternetExplorer control's tab
    By david90 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-04-2013, 06:23 PM
  2. Replies: 1
    Last Post: 05-04-2012, 06:03 AM
  3. How to make WebBrowser control display different HTML files on subsequent macro runs
    By VTHokie11 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-16-2012, 09:34 AM
  4. Replies: 1
    Last Post: 03-24-2012, 12:46 PM
  5. userform webbrowser to preview HTML code.
    By D_Rennie in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-26-2009, 01:47 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1