Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
sub AddAttachment_OnClick()
Dim dlgAttach As FileDialog
Dim strMyFile As String
Dim varChosen As Variant
Set dlgAttach = Application.FileDialog(msoFileDialogFilePicker)
With dlgAttach
.ButtonName = "Attach"
.InitialView = msoFileDialogViewList
.Title = "Choose file to attach"
.AllowMultiSelect = False
'Set up file types
With .Filters
.Clear
.Add "Word docs", "*.doc"
.Add "Excel sheets", "*.xls"
.Add "PDFs", "*.pdf"
End With
'set default file type
.FilterIndex = 1
'show dlg box
If .Show = -1 Then
For Each varChosen In dlgAttach.SelectedItems
strMyFile = varChosen
Next varChosen
End If
End With
'dump the chosen file name into a txt control on our form
forms!myform!MyControl=strMyFile
end sub
if nz(dir(strMyfile),"")="" then 'not found
msgbox("File doesn't exist")
'have the user browse for file again or set path to empty cos there's no point in storing a knackered value
end if
Application.FollowHyperlink Forms!YourForm!YourField(that has the location of the document)