Skip to content

Instantly share code, notes, and snippets.

@DuongAQ
Created June 12, 2018 09:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DuongAQ/f669ba10815956e1b8fe2f6fcfc08398 to your computer and use it in GitHub Desktop.
Save DuongAQ/f669ba10815956e1b8fe2f6fcfc08398 to your computer and use it in GitHub Desktop.
Private Sub UserForm_Initialize() 'Nạp danh sách ảnh vào combobox
Application.ScreenUpdating = False
Dim fA()
Dim i, n As Integer
Dim dName As Variant
ChDir "D:\03_HEO2018\12_Userform-Get-Picture-by-combobox" 'Địa chỉ đường dẫn nơi chứa ảnh
dName = Dir("*.jpg") 'Tên đối tượng được chọn là các ảnh có đuôi .jpg trong thư mục
'Nạp các đối tượng có trong thư mục vào trong 1 danh sách
Do While dName <> ""
n = n + 1
ReDim Preserve fA(1 To n)
fA(n) = dName
dName = Dir()
Loop
'Nạp danh sách vào Combobox cbSale
For i = 1 To n
cbSale.AddItem fA(i)
Next
Application.ScreenUpdating = True
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment