none
Redirection To Correct Program Files Folder On OS x86 RRS feed

  • Question

  • Having an issue with Word 2010 & 2013 not being able to redirect VBA to find .Net TypeLib references in the correct [ProgramFilesFolder] when moving from x64 to a x86 machine.  This shows up in the references dialog whereby the path to the TypeLib file is pointing to 'Program Files (x86)' and not 'Program Files'.  This is only happening when developing and saving the Word addin on a x64 machine, and then copying to a x86 machine for testing.

    Background:  

    I have created the following...

    • .Net assembly (which is referenced and registered for COM Interop).  This is on a development x64 machine.  The path to the assembly is 'C:\Program Files (x86)\MyAssembly\'
    • Word addin (.dotm) which references the .Net assembly.  This is on the development x64 machine.  The path to the addin is 'C:\_SourceCode\MyAddin\'
    • I install the assembly into [ProgramFilesFolder]\MyAssembly\
    • I install the addin into  [ProgramFilesFolder]\MyAddin\

    I have installed and tested on another x64 machine without any failed references, whereby the addin correctly finds the assembly in the expected [ProgramFilesFolder] of 'Program Files (x86)'.

    I have installed and tested on a x86 machine and the references fail, whereby the addin is trying to locate the assembly in 'Program Files (x86)' folder and not in the 'Program Files' folder.  This is when the redirection to the correct [ProgramFilesFolder] fails.  (This also fails if the test box happens to be office 2013, but not that it matters).

    On the x86 test box, I then repoint the addin references to the correct [ProgramFilesFolder] 'Program Files', it picks up the references ok, compiles fine and execution succeeds.  I then resave this addin on the x86 box and copy back to the x64 box whereby it again finds the correct [ProgramFilesFolder] 'Program Files (x86)' (note, it has been redirected to the correct folder).

    2 questions...

    • Why is this reference redirection failure happening when moving one way, from x64 to x86, but not back the other way?
    • What is the recommended best practice in order to avoid this issue from occurring when rolling out to client machines that may also still be on x86 operating systems?

    Monday, November 9, 2015 4:14 PM

All replies

  • Hi Matt,

    >> Having an issue with Word 2010 & 2013 not being able to redirect VBA to find .Net TypeLib references in the correct [ProgramFilesFolder] when moving from x64 to a x86 machine.

    In my option, the reference paths are stored in word file (.dotm). If your reference path changed from x64 to x86, it was expected behaviour because the reference is not in the ‘Program Files(x86)’.

    >> Why is this reference redirection failure happening when moving one way, from x64 to x86, but not back the other way?

    Where your net TypeLib was registered from x86 to x64? If they both are registered in ‘Program Files(x86)’, it would not get any issue, because they could find the right path.

    >> What is the recommended best practice in order to avoid this issue from occurring when rolling out to client machines that may also still be on x86 operating systems?

    I suggest you check project references, remove the incorrect references, and add correct reference programlly, you could refer the link below for more information.

    # How to check and remove incorrect project references in the Visual Basic Editor in Word
    https://support.microsoft.com/en-us/kb/308340

    Best Regards,

    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Tuesday, November 10, 2015 6:49 AM
  • Thanks Edward, i will investigate as below

    >> If your reference path changed from x64 to x86, it was expected behaviour because the reference is not in the ‘Program Files(x86)’.

    >> Where your net TypeLib was registered from x86 to x64? If they both are registered in ‘Program Files(x86)’, it would not get any issue, because they could find the right path.

    Yes, i see your point here, and I think this is a failure in my testing, and hence incorrect assumption from the result as seen.  i shall retest this situation by having the addin outside of the [ProgramFilesFolder] at the point i redirect the references.  Then save and move back to the x64 box and see what happens

    >> I suggest you check project references, remove the incorrect references, and add correct reference programlly, you could refer the link below for more information.

    Thanks for this link.  I shall investigate the link further and see if it's usable in house.  The obvious problem here though is that i can almost guarantee that all of our clients will not have the Trust access to the VBA project object model check box checked, and so this code will never be allowed to run, let alone be able to apply our signature certificate (which they obviously wont be in possession of) before saving the addin in the [ProgramFilesFolder] (*which they almost certainly will not be allowed to do either.

    Will let you know how i get on

    cheers M

    Tuesday, November 10, 2015 10:38 AM
  • Edward, i've tested this as below...

    >>If they both are registered in ‘Program Files(x86)’, it would not get any issue, because they could find the right path.

    Yes, when i redirect the reference from 'Program Files (x86)' to 'Program Files' both the .Net TypeLib and word addin template are located in 'Program Files', so yes, they have the same relative path.  However, the point being is that when the addin is saved and moved back to the development x64 box the typelib and addin are no longer in the same location....  the .Net TypeLib is located in 'Program Files (x86)' and the word addin is not even located in there at all, since it lives in 'C:\_SourceCode\MyAddin\'.  And yet the word addin still manages to redirect to  'Program Files (x86)' from 'Program Files'.

    And as if to confirm this, i can move the the word addin on the x86 box to a completely different location (not in 'Program Files'), do the redirection, save it and move it back to the x64 box, and word still redirects correctly.

    And, THIS addin can happily move between the 2 boxes (x86 & x64) and always manage to redirect correctly, no matter where the addin itself is located.  BUT, when it is initially created on the x64 box it cannot redirect correctly on the x86.

    M

    Tuesday, November 10, 2015 11:27 AM
  • Hi Matt,

    I am glad you found the solution for your issue. I assume it might be related with permission issue when write file to Program Files(x86), but I am not sure.

    I suggest you mark your reply as answer, and then other who run into the same issue could find the solution.

    Best Regards,

    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Wednesday, November 11, 2015 7:43 AM
  • hi Edward

    i've only found a workaround to the problem, and that is by saving the addin on a x86 machine before i compile the msi and distribute to clients.

    neither of my 2 questions above have been answered, so i cannot mark any response in this thread as answered.

    matt

    Thursday, November 12, 2015 10:16 AM
  • Hi Matt,

    >> However, the point being is that when the addin is saved and moved back to the development x64 box the typelib and addin are no longer in the same location

    What do you mean by “the addin is saved and moved back”? Did you want to distribute word add-in to x64 and x86 pcs? If so, why you want to save the addin and move it? It would be helpful if you could share us steps about your issue.

    >> And as if to confirm this, i can move the the word addin on the x86 box to a completely different location (not in 'Program Files'), do the redirection, save it and move it back to the x64 box, and word still redirects correctly.

    I want to know whether your project would work correctly if word add-in in other location like “D:\“.

    If I misunderstood you, please feel free to let me know.

    Best Regards,

    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Monday, November 16, 2015 6:22 AM