VBA: เปิดไฟล์ Excel
VBA Code
Sub OpenFile()
Dim filter As String
Dim captain As String
Dim customerFilename As String
Dim customerWorkbook As Workbook
'Text file and path
'สามารถกำหนดชนิดของไฟล์ที่ต้องการให้เปิดได้
filter = "Excel files(*.xls),*.xls,Excel files(*.xlsx),*.xlsx,All Files(*.*),*.*"
captain = "Please Select an input file"
customerFilename = Application.GetOpenFilename(filter, , captain)
If customerFilename = "False" Then
Exit Sub
Else
Sheet1.Range("B5").Value = customerFilename
Set customerWorkbook = Application.Workbooks.Open(customerFilename)
End If
End Sub
Good Luck
0 ความคิดเห็น:
แสดงความคิดเห็น