Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / January 2006

Tip: Looking for answers? Try searching our database.

Event when a document is opened?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
pnp - 06 Jan 2006 14:03 GMT
Hi.

In our company our templates is somewhat depending on the feature that has
been cancelled in word 2003. That headers and footers update when you open a
document. Therefore a macro has been created and we want to use this. I would
like this macro to run as silent as possible (meaning no matter the macro
security it should still run without prompting anyone)

I have the following scenario.
A global template located on a network share. The template is placed in the
same folder as the Workgroup template locations.
Templates in the Workgroup template location
And documents referencing the above mentioned templates.

My question is now how I add code that runs this macro that updates the
header and footers.

Is it enough if i place the code in the open event of the template. Will
that cause the macro to be run when the document based on that template is
opened?

Otherwise - is there a way in my global template i can receive an event from
the application that a new document is being opened - and i can then call
this macro on that document.

Any help is appreciated.

/Anders
Jean-Guy Marcil - 06 Jan 2006 15:31 GMT
pnp was telling us:
pnp nous racontait que :

> Hi.
>
[quoted text clipped - 4 lines]
> possible (meaning no matter the macro security it should still run
> without prompting anyone)

If the security is set to "High" then there is nothing you can do, macros
will not run by default, unless the templates are in one of the "trusted"
folders (Start-up, User templates, Workgroup templates) or are signed; and
that the option to trust installed add-ins is check on the Trusted sources
tab of the Macros security dialog.
The same with Very high applies, but then users will get a warning that
macros have been disabled, but if they are in a trusted folders, they will
run anyway.

> I have the following scenario.
> A global template located on a network share. The template is placed
[quoted text clipped - 8 lines]
> Will that cause the macro to be run when the document based on that
> template is opened?

Yes.

Signature

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org 

zkid - 08 Jan 2006 19:57 GMT
You stated that the macro worked before upgrading to Word 2003.  Does the
macro work if you run it manually after you retrieve the desired document?

If it isn't working, then your problem is a bit of changed coding in 2003
VBA.  If your macro was written for versions prior to Word 2000,
headers/footers access changed drastically in VBA and you will need to
re-code portions.  What exactly are you updating?  Field codes?  Text?

If it IS working, then you have an issue with AutoNew.  If your company is
now using a document management system (i.e., DocsOpen, iManage, Worldox,
etc.), unfortunately, those programs typically shut off your access to the
Auto-type macros (i.e., AutoNew, AutoOpen, AutoClose, AutoExec, AutoExit).  
If this is the case, you will need to request your users to execute the macro
- there is no way around it.  

Please let us know.

zkid

> pnp was telling us:
> pnp nous racontait que :
[quoted text clipped - 31 lines]
>
> Yes.
pnp - 09 Jan 2006 06:33 GMT
Well.. Not exactly.

I might not have explained it thoroughly enough. In the previous version of
word the macro was not necessary, since word itself updated the headers and
footers.

The macro itself is working correct - the issue is getting in placed
somewhere, prefereble in its own file, and then referencing this code from
all other templates.

I think Jean-Guy is on the right track, ill try that now and see if it
solves the problem.

/Anders

> You stated that the macro worked before upgrading to Word 2003.  Does the
> macro work if you run it manually after you retrieve the desired document?
[quoted text clipped - 50 lines]
> >
> > Yes.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.