Results 1 to 10 of 10

Thread: How to run InternetExplorer with long URL from VB

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2005
    Posts
    3

    How to run InternetExplorer with long URL from VB

    I use VB within MS office and would like to run IE from Excel. The codes are like these:

    VB Code:
    1. urlHeader = "http://bla.blablalalal"
    2. Set IE = CreateObject("InternetExplorer.Application")
    3. For r = 2 To 1000 Step 1
    4.     Str = Cells(r, 2).Value
    5.     url = urlHeader & Str
    6.     IE.Navigate (url)
    7.     While (IE.ReadyState <> 4)
    8.         Application.Wait 10
    9.     Wend
    10.     sRet = IE.Document.DocumentElement.OuterHTML
    11.     '........
    12. Next r
    This works fine when len(url)=<2048, but longer url is truncated by IE. Could you give me suggestions to get around this problem? Thanks a lot.

    Nanfei

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: How to run InternetExplorer with long URL from VB

    Welcome to the Forums.

    Have you tried... I'm not 100% sure it has a greater limitation but its worth a try.

    VB Code:
    1. Dim oProcess As Process
    2. Dim oPSI As New ProcessStartInfo
    3. oPSI.FileName = "C:\Program Files\Internet Explorer\IExplore.exe"
    4. oPSI.Arguments = "http://www.vbforums.com"
    5. oProcess = oProcess.Start(oPSI)
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3

    Thread Starter
    New Member
    Join Date
    Jun 2005
    Posts
    3

    Re: How to run InternetExplorer with long URL from VB

    Tried your suggestion, and got an error "User-defined type not defined" at line:
    Dim oProcess As Process

    Is there any library I should check in the reference for these codes?

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: How to run InternetExplorer with long URL from VB

    RobDog888 is off-line so I'll field this one. The Process class is in the System.Diagnostics namespace but, although I look at my own projects and see no reference and no Import, I can still use Process unqualified. If you can't, simply import the namespace or qualify the class name. Also, without RobDog888's extra code for clarity, you could also simply try:
    VB Code:
    1. Dim myProcess As Process = Process.Start("IExplore", "www.vbforums.com")
    if you specifically want to use Internet Explorer. You don't have to qualify the execuatble because the Environment Path variable will sort that out. This would not be the case for all executables, of course, which is undoubtedly why RobDog888 used the full path. Alternatively, to use the default browser try:
    VB Code:
    1. Dim myProcess As Process = Process.Start("www.vbforums.com")
    In fact, if you don't intend to use the Process object later, you don't even need to assign the result of Process.Start to a variable. Simply call it like a procedure:
    VB Code:
    1. Process.Start("www.vbforums.com")
    Last edited by jmcilhinney; Jun 16th, 2005 at 10:29 PM.

  5. #5

    Thread Starter
    New Member
    Join Date
    Jun 2005
    Posts
    3

    Re: How to run InternetExplorer with long URL from VB

    On my computer (Windows 2000 with MS Office 2000, and I use VB in Excel), 'Process' is not recognized as an known object. Any of the codes mentioned above containing 'Process" produced an error indicating the object was not defined.

  6. #6
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: How to run InternetExplorer with long URL from VB

    This is a VB.NET forum. If you are using VBA then post here and if you are using VB6 or earlier then post here.

  7. #7
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: How to run InternetExplorer with long URL from VB

    Looks like I dropped the ball on this one jmcilhinney.
    "I use VB within MS office" so this is VBA.

    Moved to VBA Forum.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  8. #8
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: How to run InternetExplorer with long URL from VB

    Quote Originally Posted by RobDog888
    Looks like I dropped the ball on this one jmcilhinney.
    "I use VB within MS office" so this is VBA.

    Moved to VBA Forum.
    You're forgiven (but not for the avatar ). It was nanfei's first post so they can be forgiven too, but we all generally assume that a thread in this forum is VB.NET related. I read the thread title and it still didn't really register.

  9. #9
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: How to run InternetExplorer with long URL from VB

    See, you missed it too J.

    Check out ShellExecute API for a possible solution since you can pass an argument of just the url.


    If you think my current avatar is causing seizures then just wait for the next one.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  10. #10
    Member
    Join Date
    Nov 2002
    Posts
    59

    Re: How to run InternetExplorer with long URL from VB

    Not sure but maybe Webbrowser control??

Posting Permissions

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



Click Here to Expand Forum to Full Width