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 / June 2007

Tip: Looking for answers? Try searching our database.

automated macro insertion

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Bas Cost Budde - 28 Jun 2007 13:43 GMT
For conversion/standardisation purposes I would like to know how, upon
opening a document, I can have VBA add a macro to this document. Much like a
virus infection.

I am new to the Word environment but have ample programming experience, e.g.
with Access VBA. Just can't find the objects and methods I need.

Signature

Bas Cost Budde
Holland

Graham Mayor - 28 Jun 2007 15:45 GMT
Although macros can be stored in documents, it is not a terribly good idea
to do so, as the chances are that the user will simply turn off the macro.
There is no means of over-riding a user's preference, short of writing a
virus and you will not get help to do that here.

As a rule of thumb, macros should be stored in templates and if you want to
share macros they should be in global templates in a shared startup folder.

Signature

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor -  Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

> For conversion/standardisation purposes I would like to know how, upon
> opening a document, I can have VBA add a macro to this document. Much
[quoted text clipped - 3 lines]
> experience, e.g. with Access VBA. Just can't find the objects and
> methods I need.
Bas Cost Budde - 28 Jun 2007 15:58 GMT
Thanks for your reply. It does not fully address the thing I want to solve,
though.

Can the user do nothing against macros that run from a (central) template,
then?

I am dealing with an organisation here, that has made several choices beyond
my scope. The macro in question is to perform certain actions upon startup,
before loading a document. If it should be in, say, normal.dot, how can I
ensure the user that opens the document has the same functionality in his
Word? To my best understanding, this is about an organisation that does not
do centralized templates.

There will be another event where I will want to write code from code. Is it
possible at all to do so?

> Although macros can be stored in documents, it is not a terribly good idea
> to do so, as the chances are that the user will simply turn off the macro.
[quoted text clipped - 4 lines]
> to share macros they should be in global templates in a shared startup
> folder.
Graham Mayor - 29 Jun 2007 08:45 GMT
What is it that you are trying to do before opening a document?
The whole point of Word is that it is a single user environment that the
user can set his preferred options. If your organisation requires specific
layouts for specific documents then these should be provided in the form of
document templates which the users should be instructed and trained to use.
Whether you provide the templates centrally or individually depends on how
the system is configured.
You cannot (thankfully - as it would open the window wide to malicious code)
override the users preferences in relation to macros.

Signature

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor -  Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

> Thanks for your reply. It does not fully address the thing I want to
> solve, though.
[quoted text clipped - 24 lines]
>> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
>> Graham Mayor -  Word MVP
 
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.