Question

Why do I get an "Error 6124: You are not allowed to edit this section because it is protected." when running this code on certain machines? I do not get it on my development machine. The bookmarks are associated with form fields.

Set objWordApp = CreateObject("Word.Application")
Set oDoc = objWordApp.Documents.Open(strDocPath)
oDoc.bookmarks("CustomerName").Select
objWordApp.selection = "Mr Smith"
oDoc.bookmarks("CustomerNumber").Select
objWordApp.selection = "0001"
oDoc.save
oDoc.Bookmarks("Comments").Select
oDoc.ActiveWindow.View = 1
objWordApp.WindowState = 0
objWordApp.Visible = True
oDoc.Activate
objWordApp.Activate
Was it helpful?

Solution

In a protected/restricted document you need to refer to .FormFields instead of .Bookmarks.

Instead of:

oDoc.Bookmarks("CustomerName").Select
objWordApp.selection = "Mr Smith"

Use:

oDoc.FormFields("CustomerName").Result = "Mr Smith"

OTHER TIPS

Open the document in question. Go to File->Options->General. Untick the box "Open e-mail attachments and other uneditable files in reading view"

http://answers.microsoft.com/en-us/office/forum/office_2013_release-word/run-time-error-4605-in-word-2013-no-information/1ca02c04-5cea-484e-bd23-f4d18183c1b2?auth=1

I had this same error. It took a while to figure it out but the file permissions (in Windows) was set to Read-only.

In Windows Explorer, Right-click on the file and choose properties. Then un-check the Read-only checkbox on the General Tab.

I had the same issue as the original poster. One user got the 6124 error while other users didnt. I tried the suggestions above but none fixed the issue. What worked for me was resetting Word to its original settings using the quick fix in this MS article.

Hope it helps someone else!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top