Results 1 to 3 of 3

Thread: ShellExecute

  1. #1

    Thread Starter
    Fanatic Member SeaHag's Avatar
    Join Date
    Jul 2001
    Location
    Lake Huron
    Posts
    901

    ShellExecute

    Hello

    I found this code.. and i want to adapt it to an outlook toolbar button...
    but!!

    userform1 does not have hwnd

    What should I do??


    CODE BY MarkT ... VBFORUM

    VB Code:
    1. Option Explicit
    2. Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _
    3.         (ByVal hwnd As Long, _
    4.         ByVal lpOperation As String, _
    5.         ByVal lpFile As String, _
    6.         ByVal lpParameters As String, _
    7.         ByVal lpDirectory As String, _
    8.         ByVal nShowCmd As Long) As Long
    9. Const SW_SHOWNORMAL = 1
    10.  
    11. Private Sub cmdRun_Click()
    12.  
    13.     On Error GoTo ErrRun
    14.    
    15.     With cdbRun
    16.         .CancelError = True
    17.         .DialogTitle = "Choose a file to run"
    18.         .ShowOpen
    19.     End With
    20.    
    21.     ShellExecute Me.hwnd, vbNullString, cdbRun.FileName, vbNullString, "C:\", SW_SHOWNORMAL
    22.    
    23. ErrRun:
    24. End Sub

    Thanks

    Seahag

  2. #2
    Hyperactive Member
    Join Date
    May 2000
    Location
    Or
    Posts
    316
    If you don't have an hwnd, simply pass a 0& into the function.

  3. #3

    Thread Starter
    Fanatic Member SeaHag's Avatar
    Join Date
    Jul 2001
    Location
    Lake Huron
    Posts
    901
    Sweet thanks

    That was easy..
    One of these days I will figure out what is actually happining
    with the code I cut and paste..

    That is all

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