A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Word » Formatting Long Documents
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Copying references from template to documents



 
 
Thread Tools Display Modes
  #1  
Old May 2nd, 2005, 04:10 PM
Cameron Sutherland
external usenet poster
 
Posts: n/a
Default Copying references from template to documents

I have a template with code that needs to connect to a
database (ADO) and to do this I need to add the object
library reference. The problem I'm faced with is in the
documents that are created from this tempalte are going to
be severed from the template so I copy all the code to
them locally except I can't figure out how to get the
reference to be copied over to the documents. I tried to
do it in code :
Application.VBE.ActiveVBProject.References.AddFrom File
strPath
but with some Microsoft security patch I get this
message: "Programmic Access to Visual Basic Project is not
trusted"
Is there some way to tell Word to copy references when it
creates the documents from the template?
-Cameron Sutherland
  #2  
Old May 3rd, 2005, 03:00 PM
Shauna Kelly
external usenet poster
 
Posts: n/a
Default

Hi Cameron

Try Tools Options Security. Click Macro Security. On the Trusted
Publishers tab, tick "Trust access to Visual Basic Project".

If you have follow-up questions, I suggest you post to one of the Word VBA
newsgroups, such as microsoft.public.word.vba.general.

Hope this helps.

Shauna Kelly. Microsoft MVP.
http://www.shaunakelly.com/word


"Cameron Sutherland" wrote in message
...
I have a template with code that needs to connect to a
database (ADO) and to do this I need to add the object
library reference. The problem I'm faced with is in the
documents that are created from this tempalte are going to
be severed from the template so I copy all the code to
them locally except I can't figure out how to get the
reference to be copied over to the documents. I tried to
do it in code :
Application.VBE.ActiveVBProject.References.AddFrom File
strPath
but with some Microsoft security patch I get this
message: "Programmic Access to Visual Basic Project is not
trusted"
Is there some way to tell Word to copy references when it
creates the documents from the template?
-Cameron Sutherland



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I view the headers in template documents when I first open. Riskflex General Discussion 1 February 1st, 2005 10:51 PM
Bring custom toolbars with templates art Page Layout 2 January 21st, 2005 05:35 PM
VBA to Copy Template styles to many documents...is this OK? Barry Millman General Discussion 1 January 18th, 2005 10:06 AM
two documents open from one template that has a picture in the he. Al General Discussion 1 October 8th, 2004 09:07 AM
Many users, one set of documents Ned Ludd General Discussion 4 July 5th, 2004 11:21 PM


All times are GMT +1. The time now is 08:17 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.