I've tried to open an HTML file using<br>
<br>
RetunrValue = Shell ("IEXPLORE.EXE C:\TEMP\TEMP.htm"<br>
<br>
but it doesn't work porperly!!<br>
<br>
how can I open the browser associated with HTML pages?<br>
<br>
I have this, it might work for you...<br>
------------------------<br>
Dim FileName As String, Dummy As String<br>
Dim BrowserExec As String * 255<br>
Dim RetVal As Long<br>
Dim FileNumber As Integer<br>
Const SW_SHOWNORMAL = 1 ' Restores Window if Minimized or<br>
<br>
Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _<br>
(ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, _<br>
ByVal lpParameters As String, ByVal lpDirectory As String, _<br>
ByVal nShowCmd As Long) As Long<br>
<br>
Declare Function FindExecutable Lib "shell32.dll" Alias "FindExecutableA" _<br>
(ByVal lpFile As String, ByVal lpDirectory As String, ByVal lpResult As _<br>
String) As Long<br>
'<Code> ---------<br>
<br>
BrowserExec = Space(255)<br>
FileName = "C:\temphtm.HTM"<br>
<br>
FileNumber = FreeFile() ' Get unused file number<br>
<br>
Open FileName For Output As #FileNumber ' Create temp HTML file<br>
Write #FileNumber, " <\HTML>" ' Output text<br>
Close #FileNumber ' Close file<br>
<br>
' Then find the application associated with it.<br>
RetVal = FindExecutable(FileName, Dummy, BrowserExec)<br>
BrowserExec = Trim$(BrowserExec)<br>
' If an application is found, launch it!<br>
If RetVal <= 32 Or IsEmpty(BrowserExec) Then ' Error<br>
<br>
Msgbox "Could not find a browser"<br>
<br>
Else<br>
RetVal = ShellExecute(frmMain.hwnd, "open", BrowserExec, _<br>
"<A HREF="
Dummy, SW_SHOWNORMAL)<br>
If RetVal <= 32 Then ' Error<br>
Msgbox "Web Page not Opened"<br>
End If<br>
End If<br>
<br>
Kill FileName ' delete temp HTML file<br>
----------------------------------------<br>
On thing you must replace frmMain in the line<br>
RetVal = ShellExecute(frmMain.hwnd, .....<br>
to match your forms name or it won't work.<br>
<br>
<br>
<br>
<p> DougP<br><a href=mailto: dposton@universal1.com> dposton@universal1.com</a><br><a href= > </a><br>
MANY THANKS but I don't really understand why you give an URL as parameter if you want to open an HTML local file...<br>
<br>
I suppose that I must replace the URL with the file..¿?
Yep<br>
Some people just put generic references up. i.e.<br>
as in your case C:\TEMP\Temp.html<br>
<br>
I just tested the procedure before I posted it with our WEB site.<br>
<p> DougP<br><a href=mailto: dposton@universal1.com> dposton@universal1.com</a><br><a href= > </a><br>
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.