Page 1 of 2 12 LastLast
Results 1 to 15 of 22
  1. #1
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Gurus - please - WebBrowser.Navigate (Office XP)

    What is the exact code you use the next time around? Switching to a different URL worked without problem in a quick test I did.

  2. #2
    New Lounger
    Join Date
    Oct 2004
    Location
    Sydney, New South Wales, Australia
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Gurus - please - WebBrowser.Navigate (Office XP)

    Hans,

    please test inside Word XP, Windows XP SP2.

    URL's were on a server. Thus the URL will be something like this:

    sURL = "Cocuments and Settingsusermyfile1.htm"

    and for example:

    sURL = "Cocuments and Settingsusermyfile2.htm"

    Thus on navigate the code will be:

    myWebbrowser.Navigate sURL

    and obviously flick to the second URL on a "click" event - the click event

    I just can't understand why the second URL errors out...? for me that is.

    I will now create 2 files with "Helloworld_1" text and "Helloworld_2" text inside ".htm" file extensions.

    Thanks

    Pete

  3. #3
    New Lounger
    Join Date
    Oct 2004
    Location
    Sydney, New South Wales, Australia
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Gurus - please - WebBrowser.Navigate (Office XP)

    Sub ShowURL()

    On Error GoTo ErrorHandler

    If Me.WebBrowser.ReadyState = READYSTATE_COMPLETE Then
    'READYSTATE_UNINITIALIZED = 0,
    'READYSTATE_LOADING = 1,
    'READYSTATE_LOADED = 2,
    'READYSTATE_INTERACTIVE = 3,
    'READYSTATE_COMPLETE = 4


    Me.WebBrowser.Navigate CONST_DIR & Me.lstHelpFiles.Value & ".htm"

    lblUpdate.Caption = Me.lstHelpFiles.Value
    End If
    ' reset error handler to default

    Exit Sub
    ErrorHandler:
    'only writing to the debug window due to error problems - will delete when running perfectly
    Debug.Print Err.Description
    End Sub

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Gurus - please - WebBrowser.Navigate (Office XP)

    I am using Word 2002 SP3 on Windows XP Pro SP2. I tried this with some existing .htm files, and had no problem switching between them. If I specified the name of a non-existent file, the standard "The page cannot be displayed" message was shown inside the browser control itself, I didn't get an error message.

    I have also searched the Microsoft newsgroups, but I couldn't find anything relevant.

  5. #5
    New Lounger
    Join Date
    Oct 2004
    Location
    Sydney, New South Wales, Australia
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Gurus - please - WebBrowser.Navigate (Office XP)

    Hans,

    firstly thanks for the replies.

    Refer attached.

    Steps:

    1. Templates folder loads and I select a template to view the relevant Help documents.

    On this "first" pass evwerything is great - no problems

    2. Go back to the list of Templates and select a second "different" template.

    Choose Help - browser looks for new file and the error occurs !

    My examlpe of looking for "HelloWorld_1" and "_2" worked fine ! can you believe it.

    But following the above steps bombs !

    Thanks

    Pete

  6. #6
    New Lounger
    Join Date
    Oct 2004
    Location
    Sydney, New South Wales, Australia
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Gurus - please - WebBrowser.Navigate (Office XP)

    I have now changed the code to be run from a button and I get this message.

    Automation error
    Unspecified error

    Pete

  7. #7
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Gurus - please - WebBrowser.Navigate (Office XP)

    I don't see an attachment. It should be below 100 KB, and you must specify it just before posting - previewing your post will clear the attachment box.

  8. #8
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Gurus - please - WebBrowser.Navigate (Office XP)

    If it does work with the simple .htm files you created, there might be a problem with the file you tried originally. What happens if you temporarily replace

    CONST_DIR & Me.lstHelpFiles.Value & ".htm"

    with a constant string containing the path and filename of one of the help files?

  9. #9
    New Lounger
    Join Date
    Oct 2004
    Location
    Sydney, New South Wales, Australia
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Gurus - please - WebBrowser.Navigate (Office

    Hans,

    this is the interesting thing to remember.

    1. on the first pass ALL URL's load properly....

    2. 2nd pass - any URL fails !

    I then have tried the string in the "start/run" and no problems. So the pathing is correct.

    This is why I am so at a loss !

    Thanks

    Pete

  10. #10
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Gurus - please - WebBrowser.Navigate (Office

    For the moment, I'm stumped. Could you post (a copy of) the document with the userform? Remove sensitive or proprietary information and zip the file if it is too large. This would enable Loungers to look at the problem directly.

  11. #11
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Weert, Limburg, Netherlands
    Posts
    4,812
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Gurus - please - WebBrowser.Navigate (Office

    Have you tried using the Navigate2 method?
    Jan Karel Pieterse
    Microsoft Excel MVP, WMVP
    www.jkp-ads.com
    Professional Office Developers Association

  12. #12
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Gurus - please - WebBrowser.Navigate (Office

    Can you test your application on a machine that does not have the Windows XP SP2 update installed? Some security changes were made, as you know, but problems they cause may be difficult to isolate without testing on SP1.

  13. #13
    New Lounger
    Join Date
    Oct 2004
    Location
    Sydney, New South Wales, Australia
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Gurus - please - WebBrowser.Navigate (Office

    Good morning from Sydney,

    1. navigate2 is no different from Navigate as per MSDN ?, but you never know - I will try it

    2. Windows XP SP2 - unfortunatley all of our work PC's have been service packed. I tried on Office 2003 and Win XP SP 2 and the same result.

    The interesting thing with this WebBrowser control is the need to make the control invisible and then visible for it to work properly.

    I have zipped my form and will post now.

    Please note that I have commented out my listbox control code and now launch from a "test" commandbutton.

    I still think it is a Visible/ invisible flag.

    What I am going to do is make the form bigger for testing purposes and put all controls on the one page and not use a multipage control.

    Thanks for all your help

    Peter

  14. #14
    New Lounger
    Join Date
    Oct 2004
    Location
    Sydney, New South Wales, Australia
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Gurus - please - WebBrowser.Navigate (Office

    Some answers:

    1. I placed all of my controls onto a single - I removed the multipage control

    Thus what I had thought - re. the visible state of the WebBrowser control was at fault.

    NOw all my code works.

    BUT, BUT I want and need a multipgae control otherwise my form looks stupid as it is very cluttered.

    Any ideas gurus?

    Thanks

    Pete

  15. #15
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Gurus - please - WebBrowser.Navigate (Office

    You don't believe in making it easy for us, do you? The code behind the form refers to at least one class module that is not included in your zip file, so I can't test it. By the time I strip out most of it, and just use the command buttons to open different files into the web browser control, it works OK. <img src=/S/shrug.gif border=0 alt=shrug width=39 height=15>

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •