Opening IE Window from VB Windows Application

lauriemc

Freshman
Joined
Feb 2, 2007
Messages
26
I'm trying to open an IE Window, the IE address is actually pointed to an html file on the hard drive. I can open it fine if I use an actual web address using this code:

Dim pr as process
pr = pr.Start("IEXPLORE", "http://google.com")

But I can't do the same thing pointing to the C drive. (Perhaps opening it on C sounds barbaric. But I have clients using laptops out in the field on the open road, no IE connection while on the open road, who need access to a Help file in HTML)

How do I do this ?
 
No, it didn't.

This is the code I used:

pr = pr.Start("IEXPLORE", "file://c:/TU_Help/index.html")

and it came back with a message saying:

Cannot find 'file:///c:/TU_Help/index.html'. Make sure the path or Internet Address is correct.

What I noticed is that it put an extra slash in front of the c:

I did check the address and it checks out okay.:(
 
How odd... The following code works for me.
[csharp]
Process pr = new Process();
pr.StartInfo.FileName = "IEXPLORE";
pr.StartInfo.Arguments = "file://c:/mypage.html";
pr.Start();
[/csharp]

Its in C#, but I would assume yours should work.

One thing I do see in your code is that you are reassigning your pr to pr.start. Is that correct for VB? It doesn't look right.
 
Last edited:
this

Visual Basic:
Dim pr As Process = New Process()
pr.StartInfo.FileName = "IEXPLORE"
pr.StartInfo.Arguments = "file://c:/mypage.html"
pr.Start()

would be the VB version.

you can also try to use the shell command.

Shell("C:\Program Files\Internet Explorer\IEXPLORE.EXE " & URL_OR_PATH , AppWinStyle.MaximizedFocus)

I hope this helps.
 
Thanks everybody :)

The last solution worked wonderful - ONCE I realized I had an .htm file instead of an .html file. I would have gone around in circles for days if I hadn't finally tried testing with a mypage... right on the C drive - and then realized my extension was wrong. But i learned some things and am happy about that, thanks again
 
Back
Top