none
Unable to change References from Office 2013 to earlier versions RRS feed

  • Question

  • I have a Word VBA project written for windows 8 / Office 2013 that I wish to edit and use on a Vista / Office 2007 machine.  The procedure has references to MS Excel and MS Outlook.  The document (a .dotm) opens OK when I right click and select Open, but when I open the VBA Editor and double click on the module name it gives the error message "Error in Loading DLL".  So I go to Tools | References and get the References Dialogue box where I get, as expected, the reference to MS Excel 15.0 Object Library as MISSING and the reference to MS Outlook 15. Object Library as MISSING.  I therefore untick those references and tick the references to Excel 12.0 and Outlook 12.0.  When I click OK I get the error message "Name conflicts with existing module, project or object library".  When I then click Tools | References again, the original references are ticked and the newly selected ones are not ticked.

    I then tried simply unticking the MISSING references without selecting the new ones and clicked OK.  That gets me the original error message "Error in Loading DLL" once more, and again when I click Tools | References I get the original lot references, including the MISSING ones.

    The same thing occurs when I try it on my laptop (Windows 7 / Office 2007)

    What's going on?  Is it not possible to edit Office 2013 VBA projects on earlier versions?

    Thursday, August 15, 2013 9:12 PM

Answers

  • Hi Cindy

    Excuse the delay in replying.

    Many thanks for your suggestions.  Unfortunately the Office 2013 computer is a few hundred miles away, so I cannot get access to it to open the document to remove the references, and I fear the process would be beyond the users there.  I will try next time I visit them.

    I have got them to send me their copy of the word file (which works fine on their machine) and tried to work with that one instead of the version I brought back with me.  No luck.  I liked the idea of exporting the code, but, alas, when I click "Export" on the context menu and get the Save box, I then get "Error in loading DLL" when I click the Save button.  So no luck there either.

    Fortunately I have found a development copy of the file that I used very early on when originally writing the code on my Vista / 2007 machine before taking it to the Windows 8 / 2013 machine.  I have been able to update that to the state that I got the final file to, so at least all is not lost!

    With thanks

    Andy

    Sunday, August 25, 2013 10:05 AM
  • Hi Andy

    << I can't find any evidence of a corruption anywhere. My problem therefore is now solved, but I'm not sure why it arose in the first place. >>

    The actual VBA project inside a document can become "damaged". Worst case, you get a message about not being able to open the VB storage and the entire VBA project is lost. So count yourself lucky :-)

    Even with the new file formats, the VBA code is still written and stored in the proprietary, binary file format used by Word 97-2003, so there's no way short of writing a program in C++ to dig into it to find or correct the problem. Since the VBA is stored as a separate "entity" from the rest of the document, a damaged VBA project won't affect the document, itself.


    Cindy Meister, VSTO/Word MVP, my blog

    • Marked as answer by AndyColRomsey Thursday, August 29, 2013 7:08 AM
    Wednesday, August 28, 2013 6:11 AM
    Moderator

All replies

  • Hi AndyColRomsey,

    Do you still encounter this kind of issue?


    deny to access the Microsoft. build. evaluation.n project.

    Monday, August 19, 2013 12:02 PM
  • The problem is still there.  I have now also tried clicking the reset button in case some element of code was running.  It had no effect.

    The problem is also there in dcouments opened from the template - i.e. when I double click on the .dotm rather than right click and open.

    I notice that Excel workbooks written in Office 2013 do NOT have this problem.  I can open them in Office 2007and change the references with no problem.

    Tuesday, August 20, 2013 4:04 PM
  • Hi Andy

    Have you tried this with various documents and/or templates, or just the one?

    Have you tried removing the reference in Word 2013, before trying to open in the earlier version?

    Right off-hand, my first inclination is to say that the VBA part of the document may be damaged, which is preventing you from making the change. You could also try using File/Export in the VBA Editor to save your code to text files. Then save the template as a dotx type, which will remove the VBA part. Open it again, save it as a dotm and use File/Import to bring in the code. Now set the references (to the earlier version).


    Cindy Meister, VSTO/Word MVP, my blog

    Wednesday, August 21, 2013 10:34 AM
    Moderator
  • Hi Cindy

    Excuse the delay in replying.

    Many thanks for your suggestions.  Unfortunately the Office 2013 computer is a few hundred miles away, so I cannot get access to it to open the document to remove the references, and I fear the process would be beyond the users there.  I will try next time I visit them.

    I have got them to send me their copy of the word file (which works fine on their machine) and tried to work with that one instead of the version I brought back with me.  No luck.  I liked the idea of exporting the code, but, alas, when I click "Export" on the context menu and get the Save box, I then get "Error in loading DLL" when I click the Save button.  So no luck there either.

    Fortunately I have found a development copy of the file that I used very early on when originally writing the code on my Vista / 2007 machine before taking it to the Windows 8 / 2013 machine.  I have been able to update that to the state that I got the final file to, so at least all is not lost!

    With thanks

    Andy

    Sunday, August 25, 2013 10:05 AM
  • Hi Andy

    Sounds like the VBA part of the document really is damaged. I'm curious to learn whether working with it on the 2013 machine, when you get a chance, yields useful results.

    But it sounds like you've found a viable workaround with the development copy, so I hope everything is now such that you can procede with your work?


    Cindy Meister, VSTO/Word MVP, my blog

    Sunday, August 25, 2013 10:58 AM
    Moderator
  • Hi Cindy

    I now have had access to the Windows8 / Office 2013 laptop with the offending Word file on it.  As you suggested, I removed all the references that I could (i.e. Outlook 15 and Excel15), saved it and the looked at it on my Vista / 2007 machine.  Sure enough it opened OK in the VBE, and the relevant reference to Word had changed automatically to Word 12.  Opening the file without previously removing the references causes the same problem.  I can't find any evidence of a corruption anywhere.

    My problem therefore is now solved, but I'm not sure why it arose in the first place.  Many thanks for your help

    Andy C

    Tuesday, August 27, 2013 6:18 PM
  • Hi Andy

    << I can't find any evidence of a corruption anywhere. My problem therefore is now solved, but I'm not sure why it arose in the first place. >>

    The actual VBA project inside a document can become "damaged". Worst case, you get a message about not being able to open the VB storage and the entire VBA project is lost. So count yourself lucky :-)

    Even with the new file formats, the VBA code is still written and stored in the proprietary, binary file format used by Word 97-2003, so there's no way short of writing a program in C++ to dig into it to find or correct the problem. Since the VBA is stored as a separate "entity" from the rest of the document, a damaged VBA project won't affect the document, itself.


    Cindy Meister, VSTO/Word MVP, my blog

    • Marked as answer by AndyColRomsey Thursday, August 29, 2013 7:08 AM
    Wednesday, August 28, 2013 6:11 AM
    Moderator
  • Hi Cindy

    Thanks for that explanation and your comments.

    Andy C

    Thursday, August 29, 2013 7:10 AM
  • Further information on the above snag

    I have just received the file by email from the owners, and copied it to a folder (with the same path etc as the owner's) on my system.  When I opened the file and some of the event code ran as I changed worksheets, I got error messages as before about DLLs.  Again I tried to change the references from Word 15 (the owner having Office 2013) to Word 12 (my machine running Office 2007) and tried to save the change, and I got further error messages.  When I closed and reopened the file, the references had not changed, so I was stuck with the problem.  I then deleted the file from my folder, re-copied it from the email, opened it without any event code having run and changed the references.  This worked OK and the file now runs as expected.

       The problem seems therefore to be that references in Excel 2013 files cannot be changed after the code that uses the references has run.

    Hope this helps anyone who finds the same problem.

    Andy C

    Wednesday, October 23, 2013 3:00 PM
  • Hi Andy

    If there are events active then it makes sense that the references cannot be changed: Those events are still "running" in the background.


    Cindy Meister, VSTO/Word MVP, my blog

    Wednesday, October 23, 2013 3:11 PM
    Moderator
  • Hi Cindy

    Thanks.  I now understand, though I had not realised that an event, once the code had completed, was effectively still "running".

    So am I right in assuming that, if the problem should occur when an event happened on opening the workbook, the only way around it would be to disable macros with the file not open, open the workbook, change the references, save it, close it, re-enable macros and then re-open the file?

    Andy C

    Wednesday, October 23, 2013 4:30 PM