Share via

The OpenDataSource method or property is not available because a macro is currently running

Anonymous
2023-01-03T11:16:53+00:00

Since the introduction of Word version 2211, I've had a problem with a VB.NET application that generates a data set (DAT file) and automatically merges with Word templates. I see the Word object open (with "Viewing" showing in the top right) but then closes throwing back the error

"The OpenDataSource method or property is not available because a macro is currently running."

It appears to relate to the new "Editing", "Reviewing" and "Viewing" options introduced in Word. The application uses the Microsoft interop to interact with the Word object and I believe the code it fails on is "MailMerge.OpenDataSource".

Rolling back the version to 2209 resolves the issue, so it definitely relates to functionality introduced in 2211 onwards. I've also tried in the beta channel for 2301 but that also has the same issue.

It seems that when it opens the template file, it defaults to opening in "Viewing" mode and I guess this is what is preventing the mail merge? Are there any options to prevent a document opening in "Viewing" mode? It's all done programmatically, so not sure if it would require development work on the application or if a setting can be changed in Word.

Microsoft 365 and Office | Word | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

30 answers

Sort by: Most helpful
  1. Anonymous
    2023-02-14T20:40:00+00:00

    I see they released 2302 on the 13th. Its 2302 (Build 16130.20128). Has anyone had a chance to try it on a site that has the problems discussed here?

    Can we or how can we get Microsoft to comment on this situation? We all need to know how things like the Trusted Sites and other basic parameters work and if they are affected by Group Policies.

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2023-02-09T17:05:55+00:00

    I can confirm that doing a .Add instead of a .Open seems to have fixed the issue for me also..

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2023-02-07T19:42:09+00:00

    I am with James on this one. We should get to the bottom of this as it ups our knowledge of how Microsoft is changing how they look at trusted sites and files. In our case the text that is to be merged into the Word Document is always on the user's desktop. What is safer than that? The letter templates are on a network drive which they all have permission too. What change was the change that was implemented in late 2022 that breaks the existing logic?

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2023-02-07T18:59:36+00:00

    Thanks Chris. Yes that’s exactly what I’m seeing also. What I can’t understand is why it works on some machines without a code change. I’m hoping to avoid making code changes as there are many applications we’d need to update and as it works for some users, it feels like there must be an alternative solution. It’s like you can disable that “Viewing mode” somehow but I’ve not figured out how yet.

    Was this answer helpful?

    0 comments No comments
  5. Anonymous
    2023-02-07T16:56:31+00:00

    Here is the message I was referring to that seems to be preventing the mail merge, it wouldn't let me upload it on my original message.

    Was this answer helpful?

    0 comments No comments