rafi_07max
11-05-2010, 08:39 PM
One fast question. Below is the codes i use open one file type. For e.g. to open .txt file,
Private Sub CommandButton1_Click()
Dim MyFile As String
MyFile = Application.GetOpenFilename("Text Files,*.txt")
ens sub
How should i modify this so that i can open all file type?
frank_m
11-06-2010, 12:22 AM
Try This
Private Sub CommandButton1_Click()
Dim MyFile As Variant, objshell As Object
'ChDrive "J:\" '<-- Optional Change Directory
'ChDir "J:\MyFolder\" '<-- Optional Change Path
MyFile = Application.GetOpenFilename("All files,*.*," _
& "Text Files,*.txt,Excel-files,*.xls,Word Files,*.doc," _
& "PDF Files,*.pdf,", 1, "Select folder and file to open", , False)
If TypeName(MyFile) = "Boolean" Then Exit Sub
Set objshell = CreateObject("WScript.Shell")
objshell.Run """" & MyFile & """"
End Sub
rafi_07max
11-06-2010, 05:14 AM
Thanks frank for your help. Your codes did work.:clap2:
fishchoke
04-29-2011, 12:14 PM
helped me too
thanks so much
:2jump:
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.