none
Word template behaves different on different Windows versions RRS feed

  • Question

  • Hi,


    I have a problem with using templates I created containing macros on different plattforms. I created the template on Windows 7 and

    Word 2016. It uses commands from msxml6.dll to read from xml files. When my clients try to run it on Windows 10 and Word 2016 they get a compilation error. After some research I found that it is this line that causes the error:

    Global xmldocMessages As MSXML2.DOMDocument60

    If I access the client's computer and edit the line, saves the template and then restores the line to its original code and saves

    again it works fine both on the client's computer and on mine. I have also tried to do the same editing on a virtual computer with

    Windows 10 and Word 2013 and it works fine. If I do the same on my computer (Windows 7 and Word 2016) it doesn't work.

    What can cause this problem and how can I avoid it?

    Regards, Åsa

    Thursday, May 4, 2017 7:56 AM

All replies

  • Hi asaboholm,

    where you added this line in your code?

    Global xmldocMessages As MSXML2.DOMDocument60

    if possible then try to post a sample code. so that we can try to test the issue on our side.

    make sure that reference for MSXML2 added correctly and your code able to access it.

    check that it have the same version of MSXML2 on your machine and on your client machine.

    you had mentioned that it is working on your machine when you developed this code.

    so why you need to modify it and save again on your machine?

    also if you edit the line and then again change it to original line then we can say that there is no difference and it work.

    did you get any error message? if yes let me know about that so that we can try to find information regarding that error.

    Regards

    Deepak


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, May 5, 2017 2:35 AM
    Moderator
  • Hi,

    This is the complete code in that specific module. It is however dependent on multiple other files in our application to work. I can't possibly post all the code here.

    '***************************************
    'uniForm
    'Copyright Consensis AB
    '***************************************

    Option Explicit

    'application and template constants
    Global Const strApplication = "uniForm"
    Global Const strVersion = "3.0"

    'paths
    Global strFullPathSource As String
    Global strFullPathCP As String
    Global strFullPathSettings As String

    Global xmldocMessages As MSXML2.DOMDocument60

    'objects
    Global myFile As Object
    Global myDoc As Document

    Static Sub loadConstantDataTemplate()

        Set myFile = CreateObject("Scripting.FileSystemObject")

        strFullPathSource = Options.DefaultFilePath(wdWorkgroupTemplatesPath) & "\Source\"
        strFullPathCP = strFullPathSource & "CorporateProfile.xml"
        strFullPathSettings = strFullPathSource & "uniFormSettings.xml"
       
        Set xmldocMessages = New DOMDocument60
        xmldocMessages.async = False
        xmldocMessages.Load (strFullPathSource & "uniFormMessages.xml")

    End Sub

    Wednesday, May 10, 2017 8:45 AM
  • To answer the other questions

    make sure that reference for MSXML2 added correctly and your code able to access it.
    -since I don't need to change the reference for it to work I don't think there is a problem with the reference. I just have to change the sampled line above and change it back to its original state.

    you had mentioned that it is working on your machine when you developed this code.
    -yes, it is still working on my machine with Windows 7 and Word 2016, but not on my customer's machines. After I edit the code as described above it works on both customer's machines and mine

    so why you need to modify it and save again on your machine?
    -because I can't do the developing on my customers machines. That would be very tedious and time consuming. Not to mension that all my customers would have to set a machine aside for me to work on.

    also if you edit the line and then again change it to original line then we can say that there is no difference and it work.
    -exactly, that is what is so confusing and annoying

    did you get any error message? if yes let me know about that so that we can try to find information regarding that error.
    -yes, i cet a compilation error, function in object library is not supported (directly translated from Swedish, don't know the exact description in English), on the line
    Set xmldocMessages = New DOMDocument60

    Wednesday, May 10, 2017 8:55 AM
  • Hi asaboholm,

    can you tell me which version of Microsoft XML you are using?

    if possible for you then try to use Microsoft XML 6.0 and test the code.

    I find that if user are using older versions then this kind of error occurs.

    Microsoft recommend developers to use Microsoft XML 6.0 version.

    so you can try to check it on your side and check whether it can solve the issue or not.

    Regards

    Deepak


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, May 11, 2017 9:50 AM
    Moderator
  • Hi,

    The reference is called Microsoft XML, v6.0 and refers to the msxml6.dll file.

    Regards

    Åsa

    Friday, May 12, 2017 2:40 PM
  • Hi asaboholm,

    I will try to search further and if I find any useful information then I will try to provide you.

    at present , I am not available with any other solution or work around for this issue.

    Thanks for your understanding.

    Regards

    Deepak


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, May 15, 2017 1:58 AM
    Moderator