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