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

Tip: Looking for answers? Try searching our database.

Spawned document from Template (Dot) loses macros

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Joshua - 12 Sep 2007 21:24 GMT
Here is a screenshot I am working on:
http://www.jkfweb.com/files/Example.JPG

The file is a .Dot template file.  It works great normally when a user opens
from the Template and fills in the appropriate information.

I have a few users who want to open the file, fill in there name and the
Company Name and other appropriate fields and then save that as a .dot file.  
This would allow them to not have to re-type and look up the information
everytime.

The problem is the macros are apparently not being copied when word spawns
document1 from the template.  I'm assuming this is normal word behavior, but
haven't been able to find a solution on word.mvps.org and a quick search in
newsgroups didn't find the solution either.

Any ideas how to get the macros to go into the newly spawned document as
they are used to create new rows, do some error correction, and formatting of
fields.

Thanks in advance for any help.
Shauna Kelly - 13 Sep 2007 04:00 GMT
Hi Joshua

The way Word is designed to work is that you put your code in a template,
and users create a new document by doing File > New and choosing your
template. The template makes all your code available to the document. So
when a user saves the document, and re-opens, all those tools (command bars,
macros, keyboard shortcuts and AutoTexts) are once again available to the
document.

For more information, see
What is the relationship between a Microsoft Word document and its template?
http://www.ShaunaKelly.com/word/templaterelations/index.html

Hope this helps.

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

> Here is a screenshot I am working on:
> http://www.jkfweb.com/files/Example.JPG
[quoted text clipped - 22 lines]
>
> Thanks in advance for any help.
NZ VBA Developer - 14 Sep 2007 10:30 GMT
Shauna,

I think you missed something here. I think the process that Joshua is trying
to describe is something like this:

The user creates a new document from a template containing some code, fills
in a few of the fields in the userform and saves the resulting document as a
_template_. The user then expects to be able to create a document from this
'new' template and have the code from the original template (with the
partially completed userform) appear automatically.

The question is, why doesn't this new template contain the code that's in
the original template?

The information you've provided is the right answer, but to the wrong
question. ;-)

Joshua, the reason this new template doesn't contain any code is because the
code is - and always will be - in the original template, not in the resulting
document. So even though you're saving the document as a template, it's not
enough; you'll have to find another way.

I've been working on something similar trying to provide functionality to
allow users to rerun a macro that I think just might fit the bill. Send me an
email (on my profile) if your interested.
Signature

Cheers!

The Kiwi Koder
Go the All Blacks!!!

> Hi Joshua
>
[quoted text clipped - 40 lines]
> >
> > Thanks in advance for any help.
Joshua - 14 Sep 2007 18:20 GMT
NZ VBA Developer and Shauna,

I appreciate feedback from both of you.  NZ VBA is correct with his
assessment of the situation.

I've decided the easiest way to handle the situation is to provide the form
in .dot format and .doc format for those who want to keep a modified version
and just change certain fields.

The .doc will not lose the macros and they can save as many copies as they
like.

Thanks again!

Joshua

> Shauna,
>
[quoted text clipped - 66 lines]
> > >
> > > Thanks in advance for any help.
 
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.