Hi all,

I read up about this somewhere I have a very tiny basic program using the commondialog control. It is bieng called from a shortcut. How can I make it so it automatically closes when its finished. i.e. so the form closes when finished rather than the user having to close it.

VB Code:
  1. Private Sub Form_Load()
  2. Dim strFile As String
  3.  
  4. On Error Resume Next
  5.  
  6.     With CommonDialog1
  7.         .Flags = cdlOFNExplorer
  8.         .Filter = "Jpg (*.jpg)|*.jpg"
  9.         .InitDir = "C:\"
  10.         .DialogTitle = "Select File"
  11.         .ShowOpen
  12.         If Not .FileName = "" Then
  13.             strFile = Mid(.FileName, InStrRev(.FileName, "\") + 1)
  14.             If Dir(FAVORITES_FOLDER & strFile) = "" Then
  15.                 FileCopy .FileName, FAVORITES_FOLDER & strFile
  16.             End If
  17.         End If
  18.     End With
  19. End Sub


thanks in advance
Rob