I've got a form running perfectly with the exception of my "attach" button. I've got this macro attached to my button:
Code:
Private Sub CommandButton2_Click()
' Browse & Select File
With Application.FileDialog(msoFileDialogFilePicker)
.AllowMultiSelect = False
.Title = "Select the File that you want to insert"
If .Show = True Then
FiletoInsert = .SelectedItems(1)
Else
Exit Sub
End If
End With
' Embed File Inline
Application.Selection.InlineShapes.AddOLEObject _
FileName:=FiletoInsert, _
LinkToFile:=False, _
DisplayAsIcon:=True, _
IconLabel:=Right(FiletoInsert, Len(FiletoInsert) - InStrRev(FiletoInsert, "\"))
End Sub
When the document is unprotected. the button works and files attach as expected. However, when I turn protection on in the document, attach fails.
I've got my protection set up as shown in the attachment.
How can I get the attach macro to play nice with the protection?
Thank you!