Multi attchement upload function

0

I'm trying to create a function to upload multiple files at the same time but even with only one I get an error. What can I be programming wrong?

'FILE DIALOG OPENS UPLOAD PANEL
Private Sub Comando715_Click()
Call Selectfile
End Sub

The function created is as follows:

Public Function Selectfile() As String
Dim Fd As FileDialog
Set Fd = Application.FileDialog(msoFileDialogOpen)
With Fd
.AllowMultiSelect = False
.Title = "Por favor selecione as fotos desta peça a anexar"
If .Show = True Then
    Selectfile = .SelectedItems(1)
    Me.Anexo412 = Selectfile
Else
    Exit Function
End If
Set Fd = Nothing
End With
End Function

The error that gives me in VBA is in the following line

Dim Fd As FileDialog

Can someone help me to complete the code?

    
asked by anonymous 03.07.2015 / 13:09

1 answer

0

The FileDialog object is provided by the Microsoft Office [Nº da versão] Object Library library. The reference was probably not set or corrupted.

To enable:

Editor VBA > Ferramentas > Referências

And bookmark the library.

    
03.07.2015 / 15:31