Bác nào giúp em ý nghĩa câu lệnh này vs!

  • Thread starter trongdung91
  • Ngày gửi
T

trongdung91

Guest
22/8/14
26
5
3
Nghệ An
Mã:
openfiles = Application.GetOpenFilename _
      (FileFilter:="Microsoft Excel Files (*." & ver & "), *." & ver, _
      MultiSelect:=True, Title:="Open Files")
em cảm ơn các bác!!!
 
Khóa học Quản trị dòng tiền
Espresso

Espresso

Trung cấp
30/10/15
108
34
28
75
Better doing this for Merging Many Workbooks

FilesToOpen = Application.GetOpenFilename _
(FileFilter:="Microsoft Excel Files (*.xls?), *.xls?", _
MultiSelect:=True, Title:="Files to Merge")
 
  • Like
Reactions: trongdung91
Espresso

Espresso

Trung cấp
30/10/15
108
34
28
75
Merry Xmas
 
Espresso

Espresso

Trung cấp
30/10/15
108
34
28
75
Cơ bản cho cậu

Sub LoadExcelFile()
Dim result
result = Application.GetOpenFilename("Excel files,*.xl?", 1)
If result = False Then Exit Sub
Workbooks.Open result
End Sub

Sub OpenMulti()
Dim FileNames As Variant
Dim Msg As String
Dim I As Integer
FileNames = Application.GetOpenFilename(MultiSelect:=True)
If IsArray(FileNames) Then
Msg = "You selected:" & vbNewLine
For I = LBound(FileNames) To UBound(FileNames)
Msg = Msg & FileNames(I) & vbNewLine
Workbooks.Open FileNames(I)
Next I
MsgBox Msg

Else
MsgBox "No files were selected."
End If
End Sub

Bài mở 1 file và mở 1 lúc nhiều files . Xem cho kỹ và nhận định . Msg là để cậu hiểu từng step đi . Còn *.xl?", là ta hu ke xls, xlsx, xlxm....... To open multi files excel click 1st file, press Ctrl and hold key, continue click other files

Sub GetImport()
Dim Finfo As String
Dim FilterIndex As Integer
Dim Title As String
Dim FileName As Variant
Finfo = "Text Files (*.txt),*.txt," & _
"Lotus Files (*.prn),*.prn," & _
"Comma Separated Files (*.csv),*.csv," & _
"ASCII Files (*.asc),*.asc," & _
"All Files (*.*),*.*"
' Display *.* by default
FilterIndex = 5
Title = "Select a File to Import"
FileName = Application.GetOpenFilename(Finfo, FilterIndex, Title)
If FileName = False Then
MsgBox "No file was selected."
Else
MsgBox "You selected " & FileName
Workbooks.Open FileName
End If
End Sub

Thử mở file txt bang GetImport . Uh oh tự động Import

Đây Vi dụ cho Xmas . Không biết VBA

Merry Xmas :):)
 
Sửa lần cuối:
  • Like
Reactions: trongdung91

Xem nhiều