Solved

Method of viewing HTML from a variable

Posted on 2004-04-20
2
166 Views
Last Modified: 2010-05-02
Hi,
I have a variable containing HTML and I want to be able to display it to the user in an html viewer of some sort (ie not see the source, see the correctly formatted HTML) but WITHOUT writing it to a file first.

is this possible? how do i do it?

The writing it to a file method works ok but i have a requirement not to do that if at all possible.
0
Comment
Question by:mwoolger
2 Comments
 
LVL 8

Expert Comment

by:fozylet
ID: 10869039
IE used to allow this when you set the URL to "about:" & your_html_formatted_string in previous versions.
The IE6 am having do not allow this though.

So if you can get hold of an older version of IE control, this can be done.
0
 
LVL 17

Accepted Solution

by:
zzzzzooc earned 125 total points
ID: 10885686
You can use the WebBrowser control to render HTML. The below modifies the innerHTML of Body which modifies everything within <body></body>..

For the below, add WebBrowser1 (Project -> Components -> Microsoft Internet Controls)

Form1:
------------

Private Sub Form_Load()
    Dim sHTML As String
    sHTML = "<a href='http://www.yahoo.com'>yahoo</a>"
    'Create document based on "about:blank"
    WebBrowser1.Navigate "about:blank"
    Do Until WebBrowser1.ReadyState = READYSTATE_COMPLETE
        DoEvents
    Loop
    'Assign HTML within <body></body>
    WebBrowser1.Document.body.innerHTML = sHTML
End Sub



0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question