Problems creating Word documents programatically

Pete Hadden 1 Reputation point

I have an Access 2016 application that creates an instance of Word in order to create new documents based on templates. It works fine in 32 bit Office, but recently in 64 bit Office it works once to create a single document, but if Word is already running when I try to run it a second time I get the following:

Word has blocked macros from running because the source of the file is untrusted - citing the following file...

This happens when the Access code attempts to run:
Set WordApp = CreateObject("Word.Application")

In 32 bit Office I can run this as many times as I want and have many documents open. This problem only seems to apply to 64 bit Office and only if Word is already running - it works fine once, and then errors on the next attempt. If you then close down Word it'll work. I think this is a recent issue (last month or so) and is probably a consequence of a Windows or Office 365 update. HELP!!!!


Access Development
Access Development
Access: A family of Microsoft relational database management systems designed for ease of use.Development: The process of researching, productizing, and refining new or existing technologies.
834 questions
Word Management
Word Management
Word: A family of Microsoft word processing software products for creating web, email, and print documents.Management: The act or process of organizing, handling, directing or controlling something.
901 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Charles Qi_MSFT 966 Reputation points

    Hi, @Pete Hadden

    We recommend you to revert to a previous version of Office 365 to see if the issue can be solved.

    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in email-notifications to enable e-mail notifications if you want to receive the related email notification for this thread.

  2. Pete Hadden 1 Reputation point

    Because of this 'feature' of Word, I've been forced to re-code the way in which Access opens Word, creates a document and populates it with data from a table. I've given up using any macros in Word completely - in fact I can have Macros disabled completely. I am now using Bookmarks in the Word document, and using vba code in Access to insert the data into these instead of using mail merge fields.

    0 comments No comments