Microsoft Office Tutorials and References
In Depth Information
Forms: Placing a Picture in a Protected Form
Forms: Placing a Picture in a Protected Form
Use this procedure to insert a picture into a protected section of a form.
Example file:
Scenario: In a form, the Drawing tools and the entire
graphics layer of the document is locked out. Pictures can be
inserted into unprotected sections without difficulty; but only
those positioned in-line with text can be manipulated after
being inserted.
Inserting a picture in a protected section of the document is
only possible with the help of a macro such as this one. The
Insert Picture dialog box is displayed, the user chooses the
graphic to insert, and the macro positions it, in-line with the
text, at a bookmarked location.
Tip: To get the text to flow around the graphic, use the Insert Frame tool on the Forms toolbar
to draw a box. Insert the bookmark in the frame. Setting the height or the width of the
frame to an exact setting resizes the picture relative to its original size to the limiting
View the Appendix to learn how to store this procedure
in a Standard module.
Option explicit¶
' * * * * *¶
'Password to unprotect/protect form¶
Const password As String = ""¶
'Position where picture should be inserted¶
Const BookmarkTarget As String = "PicTarget"¶
Sub InsertPictureIntoForm()¶
'variable declaration¶
Dim doc As Word.Document¶
Dim picPath As String¶
Dim dlg As Word.Dialog¶
Dim rng As Word.Range¶
Dim ils As Word.InlineShape¶
Set doc = ActiveDocument¶
If doc.ProtectionType <> wdNoProtection Then¶
doc.Unprotect password:=password¶
End If¶
Search JabSto ::

Custom Search