Question

Locked

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

By bob ·
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...
=======

This conversation is currently closed to new comments.

5 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Answers

Collapse -

One too many fwd slashes

by tdambra In reply to Use of Webbrowser Control ...

This code works:

Dim strLocation as String

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

WebBrowser1.Navigate (strLocation)

Collapse -

Got it.

by bob In reply to One too many fwd slashes

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...
=======

Collapse -

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

by vishal_mane123 In reply to Use of Webbrowser Control ...

Try following code line

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

Collapse -

Html

by ritm0o In reply to Use of Webbrowser Control ...

here is code

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

Back to Software Forum
5 total posts (Page 1 of 1)  

Software Forums