MS Access VBA 2010 MSWORD save permission

Posted on 2012-08-28
Last Modified: 2012-09-12
I have a ms access program.
the back end data and word document is stored on a server and the folder is shared.
the front end is run from my pc, the forms and table are link to the database on the server.
the word documents get it's data from a table on the database on the server.
I made sure the user have full permission on the folders and files.
but the script below keep giving me a popup error.

the error occur at the line "objDoc.Close True   " after the printer print the word doc.
The error is a popup that say: "Run-time error '5487':
word cannot complete the save due to a file permission error."

I've tried everything I can think of, if anyone have any idea please let me know


Dim objDoc As Word.Document
Dim objWord As New Word.Application

templateName = FileName
'printer_name = "Epson Stylus C68 Series (M)"
Set objDoc = objWord.Documents.Open(templateName)

objWord.Visible = False

    LinkToSource:=True, Connection:="TABLE test", SQLStatement:="SELECT * FROM [test]"

objDoc.MailMerge.OpenDataSource Name:= _
    db_path, LinkToSource:=True, Connection:="TABLE " & FileName, _
    SQLStatement:="SELECT * FROM [" & table_name & "]"

objWord.Application.ActivePrinter = printer_name
objDoc.Close True
Question by:onestoppc
    LVL 22

    Accepted Solution

    You opened a template - I'd expect a line to do a file saveas to save it as a document - otherwise you're trying to overwrite the template.

    Sonthing like objDoc..SaveAs filename

    LVL 76

    Assisted Solution

    If you do want to save the document, do it before the merge, then just close it without saving afterwards
    objDoc.Close wdDoNotSaveChanges

    Open in new window


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Suggested Solutions

    Title # Comments Views Activity
    Show Balance 3 15
    64 bit vba timer module 2 23
    Excel 2010 question 3 23
    MS Access 2003 Form Focus Problem 4 12
    Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
    Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
    In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
    Learn how to create and modify your own paragraph styles in Microsoft Word. This can be helpful when wanting to make consistently referenced styles throughout a document or template.

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    7 Experts available now in Live!

    Get 1:1 Help Now