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-21T16:48:48+00:00

    I've just used Update Now, which has changed the version from "2301 Build 16026**.20146** Click to Run" to "2301 Build 16026.20200 Click to Run" which has resolved the problem.

    I've asked an end-user to try that and will report back.

    My code is using Documents.Add rather than Documents.Open

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments
  2. Anonymous
    2023-01-25T12:01:58+00:00

    We are testing currently with 2212 (Build 15928.20216).

    Looks like we are facing a similiar problem when accessing Word via an automated OLE mail merge using a 32bit application (using .docx, docm, .doc).

    We are also using those files as a "template" to generate the final mail merge document.

    It seems to be that not all users are facing this problem.

    Logging out from the Microsoft account could be also a workaround to circumvent this problem, at least it helped during some of our tests.

    Any news on that?

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2023-01-19T01:36:04+00:00

    I’m not aware of a KB# but we think it was Release version 2211 Build 15831.20190.

    Thanks for the info @James Gardiner1.
    I wonder if Version 2212 Build 16.0.15928.20196 (which is my version) would correct the issue.
    I'll try that tomorrow once I get back into the office & if promising,
    I'll post back.

    -israel

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2023-01-18T21:33:26+00:00

    Is there a KB # for this patch that is causing this issue?
    -israel

    Was this answer helpful?

    0 comments No comments
  5. Anonymous
    2023-01-17T09:48:55+00:00

    Thanks for the information! The win32 thing might also explain why it works for a small number of our users and not others. I’ll follow that up with them.

    Was this answer helpful?

    0 comments No comments