469,349 Members | 1,699 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,349 developers. It's quick & easy.

Control to preview HTML text

759 512MB
Hello !

I am looking for a control (if exist) to preview HTML file as this fil will appear in a internet browser.
The goal is to use Access database to store HTML tags/syntax then use this database to create HTML files.
So I like to have a small area in my form where to preview the web page.

I know that I can open the .html file in my browser and refresh from time to time the page, in order to see the results, but I think that is easier to see at any time, in my form, if the created HTML code work as I expect.

Thank you !

PS Access 2007
Mar 31 '12 #1

✓ answered by Stewart Ross

Hi Mihail. If you look at the ActiveX controls available from the forms design list you should be able to add a Microsoft Web Browser control to your form. You can set the browser to display the contents of an HTML file by using its Navigate method. For example, if the control was called WebBrowser and you place an HTML file called YourWebPage.html in the same folder as the database, you could navigate to it by placing the following line in your form's On Load event sub:

Expand|Select|Wrap|Line Numbers
  1. Me.WebBrowser.navigate CurrentProject.Path & "\YourWebPage.html"
-Stewart

6 14894
Stewart Ross
2,545 Expert Mod 2GB
Hi Mihail. If you look at the ActiveX controls available from the forms design list you should be able to add a Microsoft Web Browser control to your form. You can set the browser to display the contents of an HTML file by using its Navigate method. For example, if the control was called WebBrowser and you place an HTML file called YourWebPage.html in the same folder as the database, you could navigate to it by placing the following line in your form's On Load event sub:

Expand|Select|Wrap|Line Numbers
  1. Me.WebBrowser.navigate CurrentProject.Path & "\YourWebPage.html"
-Stewart
Apr 1 '12 #2
NeoPa
32,184 Expert Mod 16PB
There is no way for HTML to be previewed except via a link of some kind. You cannot formulate a string, as you can for SQL for instance, and then pass that string to a browser control, if that was what you were wondering.

As long as it's saved somewhere first though, Stewart's post tells you how to preview it.
Apr 1 '12 #3
Mihail
759 512MB
Thank you for replies.
I can not find this control (Microsoft Web Browser) or something similar in Access 2007.
I see this control in Excel 2007, in Word 2007 (I play a little bit with it in this applications) but not in Access 2007.
Is nowhere. :(
Apr 1 '12 #4
Stewart Ross
2,545 Expert Mod 2GB
Can't think why it does not appear in your list of ActiveX controls in Design view, Mihail. It appears in my A2007 installation, and also in a separate laptop installation of A2010 I use.

If the ActiveX control itself is not registered for A2007 you can try registering it by following the advice in this knowledgebase article. I can't test this as mine is already registered correctly.

The DLL file involved is C:\Windows\SysWOW64\ieframe.dll

-Stewart
Apr 1 '12 #5
Mihail
759 512MB
Thank you very much, Stewart !

I test the advices from your link and it works.
For Windows XP/32 bytes the involved file is
Expand|Select|Wrap|Line Numbers
  1. C:\WINDOWS\system32\shdocvw.dll
More one thing for every one who read this thread (because I have wasted a lot of time because I have not know where to look for ActiveX controls which are not in the ribbon):

In Form Design View, under tab Design, in Controls area it is a button Insert ActiveX Control.
Apr 1 '12 #6
Mihail
759 512MB
This code will preview an HTML string into a Microsoft WebBrowser Control

Expand|Select|Wrap|Line Numbers
  1. Dim HTML As String
  2.     HTML = "<HTML>"
  3.         HTML = HTML & "<p> Preview my HTML string </p>"
  4.     HTML = HTML & "</HTML>"
  5.  
  6. Dim obj As HTMLDocument
  7.    Set obj = WebBrowserControlName.Document
  8.    obj.body.innerHTML = HTML
Apr 13 '12 #7

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

4 posts views Thread by Ed West | last post: by
2 posts views Thread by Frank Bishop | last post: by
2 posts views Thread by Chad | last post: by
5 posts views Thread by serge calderara | last post: by
4 posts views Thread by sreejith.ram | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.