Insert file in formfield in Word

L

Lynn

I'm trying to insert a file into a form at a bookmarked location. It works when the form is not protected, but doesn't when the form is. So how would I insert a file into a protected form. I also tried to use a formfield, but it doesn't work either. It is inserted half way through the form, so using unprotect is not an option that I know of

Sub CourseType(
Dim vCourseType As Strin
Dim vGoal2 As Strin
Dim CoType As FormFiel
Dim CoTypeGoal1 As Bookmar
Dim CoTypeGoal2 As FormFiel


vCourseType = InputBox("Please choose the type of course:" & Chr(13) & "1 - General Education" & Chr(13) & "2 - Vocational" & Chr(13) & "3 - Both", "Course Type"

Select Case vCourseTyp
Case "
MsgBox "You did not enter a value, please try again", vbOKOnly + vbExclamation, "Blank Entry
CourseTyp
Case "0
MsgBox "The number 0 is not a valid entry, please try again", vbOKOnly + vbExclamation, "Invalid Number
CourseTyp
Case "1
ActiveDocument.FormFields("CoType").Result = "general education
ActiveDocument.Bookmarks("CoTypeGoal1").Range.InsertFile ("E:\Lynn\files for template\Gen Ed Goal Areas.doc"

Case "2
ActiveDocument.FormFields("CoType").Result = "vocational
<the rest is snipped

In Case "1", second line is the problem. Thank you in advance for your help

Lynn
 
P

Peter Hewett

Hi Lynn

You have to unprotect the document, do your updates and then reprotect your
document:

ActiveDocument.Unprotect

insert your file here using a bookmark not a FormField, otherwise you could
end up overwriting the FormField.

ActiveDocument.protect wdAllowOnlyFormFields,True

HTH + Cheers - Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top