Ok, call me stupid, but I can't for the life of me figure out why this wont work...
Private Sub mPopHelp_Click()
Shell "IExplore " & App.Path & "\help\index.htm", vbMaximizedFocus
End Sub
Any help would be greatly appreciated
Printable View
Ok, call me stupid, but I can't for the life of me figure out why this wont work...
Private Sub mPopHelp_Click()
Shell "IExplore " & App.Path & "\help\index.htm", vbMaximizedFocus
End Sub
Any help would be greatly appreciated
What happens when you try it? What is value in 'App.Path'?
Odds are it isn't working either because IExplore.exe or App.Path + "\help\index.htm" cannot be found.
Call ShellExecute(0&, vbNullString, App.Path + "\help\index.htm", vbNullString, vbNullString, vbMaximizedFocus)
try that
and this
Option Explicit
Private Declare Function ShellExecute Lib "shell32.dll" _
Alias "ShellExecuteA" ( _
ByVal hWnd As Long, _
ByVal lpOperation As String, _
ByVal lpFile As String, _
ByVal lpParameters As String, _
ByVal lpDirectory As String, _
ByVal nShowCmd As Long) As Long
a long way around but it works
Its telling me that the file isn't found when I run the code. I know its there and I know I've got the correct path. The value of App.Path is "C:\Windows\Desktop\VB Projects\Lead Tools". I'd use ShellExecute, but that opens the file in the default viewer if I'm not mistaken. I need it to open in Internet Explorer regardless of what the default browser is.
Shell can only be used to open .EXE files.
i don't know how to force a program to open a file.
Try using the short pathname to the file. The spaces in the long pathname might be causing your problem.
Its not the long path name, I tried that and it still did the same thing. I did find a way to make it work though. This way works just fine...
Shell("C:\Program Files\Internet Explorer\IExplore.exe " & App.Path & "\help\index.htm", vbMaximizedFocus)
But this doesn't...
Shell "IExplore " & App.Path & "\help\index.htm", vbMaximizedFocus
Can someone tell me why ? If I go to Run and type in the latter of the two it works fine too. I know that shell works by using "notepad" instead of the full path, and also various others. I'm just confused as to why it wont work with IExplore. I was hoping to not have to specify the path of Internet Explorer in case for some strange Internet Explorer isn't located where it should be. I really dont know if that is a valid fear or not. Does anyone know what the chances of that happening are ? If its not worth worrying about then I'll just leave it, if it's something you think I should fix then I'll make the program get the location out of the registry. Anyway, thanks for your help...
maybe cos Iexplore is not in the windows directory?
there will be a peice of code somewhere that tell you the path of iexplor on the pc the program is on.
its somthing like %windir%