Results 1 to 9 of 9

Thread: Problem with Shell

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2002
    Posts
    10

    Problem with Shell

    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

  2. #2
    PowerPoster jdc2000's Avatar
    Join Date
    Oct 2001
    Location
    Idaho Falls, Idaho USA
    Posts
    2,526
    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.

  3. #3
    Member
    Join Date
    Mar 2002
    Location
    Australia
    Posts
    39
    Call ShellExecute(0&, vbNullString, App.Path + "\help\index.htm", vbNullString, vbNullString, vbMaximizedFocus)
    try that
    BOO

  4. #4
    Member
    Join Date
    Mar 2002
    Location
    Australia
    Posts
    39
    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
    BOO

  5. #5

    Thread Starter
    New Member
    Join Date
    Feb 2002
    Posts
    10
    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.

  6. #6
    The picture isn't missing BuggyProgrammer's Avatar
    Join Date
    Oct 2000
    Location
    Vancouver, Canada
    Posts
    5,217
    Shell can only be used to open .EXE files.

    i don't know how to force a program to open a file.
    Remember, if someone's post was not helpful, you can always rate their post negatively .

  7. #7
    PowerPoster jdc2000's Avatar
    Join Date
    Oct 2001
    Location
    Idaho Falls, Idaho USA
    Posts
    2,526
    Try using the short pathname to the file. The spaces in the long pathname might be causing your problem.

  8. #8

    Thread Starter
    New Member
    Join Date
    Feb 2002
    Posts
    10
    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...

  9. #9
    Member
    Join Date
    Mar 2002
    Location
    Australia
    Posts
    39
    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%
    BOO

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width