Creating a form that will allow users to insert pictures

  • Follow


I am creating a form in Office Word 2003 where I am putting in  mostly Text 
Form Fields. I also want the people filling in the form to be able to insert 
photos. Once the document is secured the options for insert photos is not 
available. I have also tried insert frame then securing but still does not 
allow person filling in form ability to insert photo. How can this be done?
0
Reply Utf 2/15/2010 2:57:01 PM

Assuming that you are supplying the form as a template and that you can be 
sure that users will allow the macros it contains to run, then you can 
provide a macro to insert a picture. Insert a table (you only need one cell) 
and set the cell width to the fixed width that you wish the picture to 
adopt. The height of the cell is less relevant, but set it to sufficient 
height that inserting a picture will not upset your layout. Remove any 
border from the cell.

If your form is already laid out as a table of with tables, you will need to 
identify the table index of your new 'table'. The macro assumes the first 
cell in Tables(1)
from the line Set oRng = oDoc.Tables(1).Cell(1, 1).Range. Change the cell 
location if required. You can then run the macro from a toolbar button on a 
custom toolbar in the template - at at a pinch on exit from a form field. - 
http://www.gmayor.com/installing_macro.htm .

It is possible to set the start location for the picture folder to the 
user's My Pictures folder, but it requires a lot more code. If you need to 
do that contact me via my web site and I'll mail you the extra code.


Dim strFilePath As String
Dim oDoc As Document
Dim oRng As Range
Set Dlg = Application.FileDialog(msoFileDialogFilePicker)
Set oDoc = ActiveDocument
If oDoc.ProtectionType <> wdNoProtection Then
    oDoc.Unprotect Password:=""
End If
Set oRng = oDoc.Tables(1).Cell(1, 1).Range
oRng.Text = ""
With Dlg
    .Title = "Navigate to folder and Select Picture"
    .InitialView = msoFileDialogViewThumbnail
    .AllowMultiSelect = False
    If .Show <> -1 Then
        MsgBox "Cancelled By User", vbInformation, _
        "Select Picture"
        Exit Sub
    End If
strFilePath = .SelectedItems(1)
End With
Set oShape = oDoc.Shapes.AddPicture(FileName:=strFilePath, _
LinkToFile:=False, SaveWithDocument:=True, _
Anchor:=oRng)
oDoc.Protect _
Type:=wdAllowOnlyFormFields, _
NoReset:=True, _
Password:=""


-- 
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor -  Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>


"Jackie" <Jackie@discussions.microsoft.com> wrote in message 
news:57A5EBDD-8BE0-4D47-9EB5-47754083C418@microsoft.com...
>I am creating a form in Office Word 2003 where I am putting in  mostly Text
> Form Fields. I also want the people filling in the form to be able to 
> insert
> photos. Once the document is secured the options for insert photos is not
> available. I have also tried insert frame then securing but still does not
> allow person filling in form ability to insert photo. How can this be 
> done? 


0
Reply Graham 2/15/2010 3:34:31 PM


1 Replies
2544 Views

(page loaded in 0.157 seconds)

Similiar Articles:
















7/22/2012 2:02:48 AM


Reply: