snasui.com ยินดีต้อนรับ ยินดีต้อนรับสู่กระดานถามตอบ Excel and VBA และอื่น ๆ ที่เป็นมิตรกับทุกท่าน มีไฟล์แนบมหาศาล ช่วยให้ท่านค้นหาและติดตามศึกษาได้โดยง่าย สมาชิกท่านใดที่ยังไม่ได้ระบุ Version ของ Excel ที่ใช้งานจริง สามารถทำตาม Link นี้เพื่อจะได้รับคำตอบที่ตรงกับ Version ของท่านครับ ระบุ Version ของ Excel
Sub openFolder()
Dim fileToOpen As Variant
Dim fileFilterPattern As String
Application.ScreenUpdating = False
fileFilterPattern = "Excel Files (*.xls; *.xlsx),*.xls;*.xlsx ,Text Files (*.txt; *.csv),*.txt;*.csv"
fileToOpen = Application.GetOpenFilename(fileFilterPattern)
If fileToOpen = False Then
MsgBox "คุณไม่ได้เลือกไฟล์ที่จะนำเข้า", vbOKOnly + vbInformation, "ยกเลิกการนำเข้าข้อมูล"
Exit Sub
End If
End Sub
You do not have the required permissions to view the files attached to this post.
Sub openFolder()
Dim fileToOpen As Variant
Dim fileFilterPattern As String
Dim myPath As String
Application.ScreenUpdating = False
myPath = "C:\Teacher"
If Not PathExist(myPath) Then MkDir (myPath)
ChDir "C:\Teacher\"
fileFilterPattern = "Excel Files (*.xls; *.xlsx),*.xls;*.xlsx ,Text Files (*.txt; *.csv),*.txt;*.csv"
fileToOpen = Application.GetOpenFilename(fileFilterPattern)
If fileToOpen = False Then
MsgBox "คุณไม่ได้เลือกไฟล์ที่จะนำเข้า", vbOKOnly + vbInformation, "ยกเลิกการนำเข้าข้อมูล"
Exit Sub
End If
End Sub
Private Function PathExist(path_ As String) As Boolean
On Error GoTo ErrNotExist
Call ChDir(path_)
PathExist = True
Exit Function
ErrNotExist:
PathExist = False
End Function
Private Function FileExist(filePath_ As String) As Boolean
FileExist = Len(Dir(filePath_)) <> 0
End Function
You do not have the required permissions to view the files attached to this post.