By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,483 Members | 1,574 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,483 IT Pros & Developers. It's quick & easy.

Control to preview HTML text

100+
P: 759
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

Share this Question
Share on Google+
6 Replies


Expert Mod 2.5K+
P: 2,545
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
Expert Mod 15k+
P: 31,186
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

100+
P: 759
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

Expert Mod 2.5K+
P: 2,545
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

100+
P: 759
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

100+
P: 759
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.