Questions

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

+
0 Votes
Locked

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

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...
=======
  • +
    0 Votes
    tdambra

    This code works:

    Dim strLocation as String

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

    WebBrowser1.Navigate (strLocation)

    +
    0 Votes
    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...
    =======

    +
    0 Votes
    vishal_mane123

    Try following code line

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

    +
    1 Votes
    ritm0o

    here is code

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

  • +
    0 Votes
    tdambra

    This code works:

    Dim strLocation as String

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

    WebBrowser1.Navigate (strLocation)

    +
    0 Votes
    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...
    =======

    +
    0 Votes
    vishal_mane123

    Try following code line

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

    +
    1 Votes
    ritm0o

    here is code

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