[Visual Basic 2010] Open with

Solved
Anonymous user -  
 Anonymous user -
Hello,

I am looking for a code that would allow me to launch a file locally with Internet Explorer...

Example: start iexplore.exe "index.htm" (This code doesn't work, of course)

Shell("index.htm") with iexplore.exe

Thank you for getting back to me. To make it easier, the files index.htm and iexplore.exe are located relatively in the program's folder...

Bye!

Configuration: Windows 7 / Chrome 24.0.1312.57

2 réponses

ShayFmw Posted messages 121 Status Membre 43
 
Hello

Something like? Then you need to consider the path
System.Diagnostics.Process.Start("iexplore", "path to the html file")

Well, it's not necessarily very practical, I would recommend uploading this file to a web server, even a free one, and using a regular URL

Passionate about computers and video games.
It's always nice to get a "thank you", even when the response given is good and your problem is solved :)
1
Anonymous user
 
Yes, but my file is an HTM coded with Hot Potatoes (form/form exercises for teaching) and it would need to be recoded completely <- No thanks...

Thanks for your quick response, I'm testing this right away.

------> FAIL !! It's almost there, but now the button opens Internet Explorer and does a Google search for: "index.htm" and not my local file!!!

Any other ideas?
0
ShayFmw Posted messages 121 Status Membre 43
 
Yes, that's why you need to provide a full path C:\%ProgramFiles% ...
0
Anonymous user
 
Exactly! But do you know what relative link to put?
0
Anonymous user
 
The launcher is with the index.htm...
0
ShayFmw Posted messages 121 Status Membre 43
 
Ok, I made some code for you
The HTML file needs to be in the same directory as the application (although if you want to put it elsewhere, you just need to change part of the assignment to the variable)
Is it a click on a button that executes the action?
If so, in the sub of your button click:

Dim ApplicationPath As String 'we create the variable to hold the absolute path
ApplicationPath = Application.StartupPath + "\index.html" 'we retrieve and assign the path to this variable + the HTML file
System.Diagnostics.Process.Start("iexplore", ApplicationPath) 'we launch with the variable
0
Anonymous user
 
YEAH THANK YOU !! A thousand thanks!!!

The code works perfectly, I've been looking for this µ£%£ code for 3 months!! Thank you thank you thank you...
0