|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
cannot get microsoft Excel 16.0 object library to remain checked when copying word docm to wife's pc
I developed a word document with vba that uses an excel file. On my pc, the .docm resides in C:\Users\....\Documents\Custom Office Templates with the Developer>Tools>References>Microsoft Excel 16.0 Object Library Checked.
(I also set the Custom Office Templates folder as a trusted site.) When I copy the .docm to my wife's pc's C:\Users\...\Documents\Custom Office Templates the Microsoft Excel 16.0 Object Library is not checked. I enabled the Microsoft Excel 16.0 Object library through Developer>Tools>References> on my wife's copy and Saved. Multiple times. Multiple iterations. But every time I open the .docm on my wife's machine, the Excel 16.0 Object Library is unchecked. And the security warning continues to appear on each open. What I want, of course, is that the Object Library to remain checked. I'd also prefer that the security message disappears. |
#2
|
||||
|
||||
You could change the code to use late binding to Excel, then the library entry doesn't need to be checked.
Declare the Excel app as an Object and use the numeric values of any Excel specific commands. There is an example of Excel being used this way on my web site at Extract Data from E-Mail. The code there is for Outlook, but the principles for Word are identical.
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
#3
|
|||
|
|||
Thank you for your quick reply and helpful link @gmayor. Before my response, may I point to a typo in Extract Data from E-Mail A paragraph (fifth one, I believe) begins with a double-"T": "TThe basic process will..."
The article is very slick. And I understand most of it. But I think I've asked the wrong question. I now remember I have many "Quick Parts" that I doubt migrated with the document. So, though "late binding" may take care of the Excel issue, the application will remain unusable. My solution probably requires a better migration strategy. Particularly if my machine ever crashes. |
#4
|
||||
|
||||
Thanks for the heads up on the typo (now fixed). As for the other matter, you are no doubt aware that quick parts cannot be stored in a document. If you plan on sharing the document widely, you will certainly need a different approach - probably by changing the document to a template, which can store such data. The late binding will also be required to overcome the compatibility with different Excel versions.
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
#5
|
|||
|
|||
The document I'm attempting to migrate is a .dotm. Is that what you mean by a template? If so, maybe the the quick parts are moving with it. I don't know because the other issues stop me from getting to the point where the VBA invokes them.
If you're willing to indulge me, here is where I am with the migration. I believe my .dotm template migration needs to include: 1. Migrating the .docm template to my wife’s Documents>Custom Office Templates folder. 2. Establishing .dotm and Custom Office Template folder as a “Trusted Site”. (see below). 3. Copying an MS Excel file to a (new, properly named path and folder) on my wife’s machine. 3a. Permanently assigning the Microsoft Excel 16.0 Object Library to the Developer>Visual Basic>Tools>Project>References. (see below) 4. Appending my 3 “Quick Parts” Building Blocks to my wife’s normal.dotm. I’ve done 1, 2, 3 above. And Lance Whitney’s How to transfer Microsoft Word macros to another computer | TechRepublic page deals with point 4. But… (3a) Despite enabling the .dotm’s Developer tab on my wife’s PC, check-marking the Microsoft Excel 16.0 Object Library and saving the .dotm, the assignment won’t stick. Subsequent re-open of the .dotm shows Microsoft Excel 16.0 Object Library still not checked. (2) Originally there were two separate security blocks. I managed to eliminate one of them through MS file level security (though I don’t recall how I did it), but the “untrusted” message persists. When I try to File>Options>Trust Center>Trust Center Settings>Trusted Locations and try to add Documents>Custom Office Templates folder, I get a popup window indicating the location is already registered. But the warning continues to appear. I am reluctant to proceed for fear of corrupting my wife’s PC as she uses it for her job. On the other hand, I need a backup plan if and when I replace my laptop. I’m running Microsoft Windows 10 Home Build 19044 on a Dell Inspiron 15-3567 using Microsoft® Word 2016 MSO (Version 2209 Build 16.0.15629.20196) 32-bit. Wife’s machine running Microsoft Windows 10 Home Build 19043 on an Acer Aspire TC-885 using Microsoft Word 365 MSO (Version 2209 Build 16.0.15629.20200) 64-bit. A response I received in another forum suggests that Microsoft does not support VBA on Office 365. I find that comment suspect. I suppose invoking a "Contact Us" on the Microsoft site might be the next step. What do you think? |
#6
|
||||
|
||||
I don't usually have a problem with References unchecking themselves so I can only guess what might be happening on your machine.
Firstly, I would check that the code compiles correctly on her machine. If it works on a 32bit version of Word then you are 99% of the way there but there may be some code that fails to compile on a 64bit machine. Secondly, verify which version of Excel she has on her machine. If it happens to be older that v16 then you should be able to reference Excel 15.0 instead. Since the file you are transferring is a template which contains building blocks there shouldn't be a reason to also copy those building blocks to her Normal.dotm template. If you have code in your template that inserts those building blocks, just make sure the VBA gets the BBs from that template.
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
#7
|
||||
|
||||
Thank you Guessed,
Quote:
Quote:
Quote:
Quote:
|
#8
|
||||
|
||||
You can compile by viewing the code and going to Debug > Compile Project.
I don't know much about computer hardware but updating the BIOS sounds completely unrelated to your issue and I wouldn't be following that path. Graham's suggestion of changing the code to Late Binding is a guaranteed fix - have you had a go at doing that?
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
#9
|
|||
|
|||
Quote:
Quote:
Quote:
Please know how I truly appreciate the effort and thinking you have put into this on my behalf. Thank you. |
#10
|
||||
|
||||
The macros will run faster if they don't have to wait for Excel to open so importing a text file source can be a lot quicker in execution.
Debugging form opening can be problematic since you just get a message that it fails showing the line of code that called the form rather than the line of code in the initialize macro where the problem resides. I usually add breakpoints in that code so I can step through the form code and isolate the issue that way.
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
#11
|
|||
|
|||
Quote:
Despite escalation, Microsoft has not gotten back to me. Not so surprising. Given their BIOS recommendation, I'd be too embarrassed to contact me too. Finally your Chrysalis Design LinkedIn page shares a quite impressive bio and professional services. Congratulations. |
Tags |
object library, references, word 2016 |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Problem with Word Mail Merge VBA - Outlook Object Library not recognized | shawnhet | Word VBA | 2 | 04-15-2015 07:51 AM |
Microsoft Excel 12.0 Object Library reference upload | chamdan | Project | 2 | 04-21-2014 06:30 AM |
object to remain in view | galgool | PowerPoint | 2 | 01-19-2013 02:47 AM |
Excel VBA: How to add a reference to Microsoft Word Object Library? | tinfanide | Excel Programming | 7 | 12-12-2011 05:21 AM |
Problem: object library invalid or contains references to object definitions | aligahk06 | Office | 0 | 08-19-2010 12:29 PM |