I'm trying to create a function to upload multiple files at the same time but I think that because I'm choosing the next function does not really attach the file, but rather creates a preview.
In my opinion, what's wrong with the code is:
Me.Anexo412.DefaultPicture = Selectfile
And besides that I need to load up to 8 files (max) simultaneously because there are 8 files that can be added in this form.
Here is the code for your analysis
'FILE DIALOG OPENS UPLOAD PANEL
Private Sub Comando715_Click()
Call Selectfile
End Sub
'FUNÇÃO CAIXA DE SELEÇÃO
Public Function Selectfile() As String
Dim Fd As FileDialog
Dim Filtro As FileDialogFilters
Set Fd = Application.FileDialog(msoFileDialogOpen)
With Fd
'FILTRO DE IMAGENS
Set Filtro = .Filters
With Filtro
.Clear
.Add "Imagens", "*.jpeg;*.jpg"
End With
'NÃO PERMITIR MULTI-SELEÇÃO
.AllowMultiSelect = True
'DEFINE O NOME DA CAIXA DE SELEÇÃO
.Title = " Por favor introduza as fotos da peça"
If .Show = True Then
'CODIGO DE COLOCAÇÃO DE ANEXO EM FORMULÁRIO
Selectfile = .SelectedItems(1)
Me.Anexo412.DefaultPicture = Selectfile
Else
MsgBox "Clicou no botão cancelar ao escolher imagem."
Exit Function
End If
Set Fd = Nothing
End With
End Function
Will any of you be able to help me with this?