Question Locked

Use of Webbrowser Control in VB6 to read a local HTML file

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Can anyone help me get the webbrowser control in VB6 to read a local html file?

I have tried for the past 4 days to find the syntax for the navigate command with no luck. I have tried everything I know but nothing works. I keep getting the message...

"This program cannot display the webpage"

So SOMETHING is happening!

I have tried...

webrowser1.navigate (c:\filepath\filename.htm)
webrowser1.navigate (file:///c:/filepath/filename.htm)
webrowser1.navigate (file:///c|/filepath/filename.htm)
webrowser1.navigate (localhost:///c:/filepath/filename.htm)

as well as...

webrowser1.navigate "c:\filepath\filename.htm"
webrowser1.navigate "file:///c:/filepath/filename.htm"
webrowser1.navigate "file:///c|/filepath/filename.htm"
webrowser1.navigate "localhost:///c:/filepath/filename.htm"

Nothing!

Do I need to use anything other than the "navigate" command???

Thanks,
bob...
=======

5 replies

by Former member

This code works:

Dim strLocation as String

strLocation = "c:\filepath\filename.htm"
strLocation = "file://" & strLocation

WebBrowser1.Navigate (strLocation)

by bob

Thanks. I actually changed over to using the .doc version of the file with a direct call to the App.Path & "\FMProTutorial.doc" and it works great.

The problem I have now is that I need the webbrowser to be in "Web Layout" mode. It comes up default in "Print Layout" mode. Do you know the syntax for getting it to display in the "Web Layout" mode? Right now I have to get the user to change it at the bottom left of webbrowser and that's not going to happen.

???
Best,
bob...
=======

by vishal_mane123

Try following code line

call webrowser1.navigate ("file://c:/filepath/filename.htm")

by ritm0o

here is code

WebBrowser1.Navigate App.Path & "\yourfile.html"

This discussion is closed to new replies.