Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


MS Access VBA 2010 MSWORD save permission

Posted on 2012-08-28
Medium Priority
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

Kelvin Sparks earned 750 total points
ID: 38344195
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 77

Assisted Solution

GrahamSkan earned 750 total points
ID: 38344452
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


Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In a use case, a user needs to close an opened report by simply pressing the Escape (Esc) key. This can be done by adding macro code in Report_KeyPress or Report_KeyDown event.
This holiday season, we’re giving away the gift of knowledge—tech knowledge, that is. Keep reading to see what hacks, tips, and trends we have wrapped and waiting for you under the tree.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…

571 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