This works with spaces in the folder name and
with spaces in the file name.
Code:'put this in a bas module ' Public Declare Function ShellEx Lib "shell32.dll" Alias _ "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, _ ByVal lpFile As String, ByVal lpParameters As Any, _ ByVal lpDirectory As Any, ByVal nShowCmd As Long) As Long ' 'Form events 'open a file with it's associated application Private Sub Command1_Click() ' Dim sFileName As String, x As Long sFileName = "c:\my documents\my special file.txt" x = ShellEx(Me.hwnd, "open", sFileName, "", "", 1) '===================================== End Sub




Reply With Quote