Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open web browser from VB 2

Status
Not open for further replies.

johnnyv

Programmer
Jul 13, 2001
216
CA
I want to open an html page from within a VB app that is stored on my PC. I am using the following code to make it happen

lngRtn = Shell("rundll32.exe url.dll,FileProtocolHandler C:\Envision\Forms & Documents\Index.htm")

this will work but I have 2 problems

First IE opens the html page but it is minimized, I
can't see it until I go to my tool bar and maximize
it. How can I fix this

Second I want to be able to execute the code above using
a variable for the HTML file path. I have the
following code to do this

lngRtn = Shell("rundll32.exe url.dll,FileProtocolHandler StrIndex_HTML_Path")

the variable StrIndex_HTML_Path contains the path of the HTML page. This line of code does not work, no IE window appears and I don't receive an error msg. Can I use this code using a variable for the HTML file path?

Thanks

 
I'm an Idiot!!, well sort of

You can ignore problem one. THe IE window was minimizing to the tool bar because I was stepping though the VB code while I was running it. So oviously VB is going to retain focus !!! The word DumbAss comes to mind!!

But with that said I still have a problem with using a variable for the file path but I do get an error msg it says
"unable to open file path StrIndex_HTML_Path"

Any thoughts?

 


do a debug.print StrIndex_HTML_Path right before your shell statement and then post the result of that here.

 
This what appears in the debug window

C:\Envision\Forms & Documents\Index.htm
 
Well here I go aagain answering my own question

the following staement did not work
lngRtn = Shell("rundll32.exe url.dll,FileProtocolHandler StrIndex_HTML_Path")

This one did
lngRtn = Shell("rundll32.exe url.dll,FileProtocolHandler " & StrIndex_HTML_Path & "")

Notice how the variable name is not inside the quote statement but instead the variable content is

bjd4jc A big thanks for taking the time and a star for you because you did.
 
Thanks johnnyv for the start. Glad I could point you in the right direction...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top