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 / April 2005

Tip: Looking for answers? Try searching our database.

Opening Word Template with Macros

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Marco Mendonça - 21 Apr 2005 17:54 GMT
I've made a template which runs some macros automatically when it's opened.
So, when i open the template, the macros work fine. The problem is when i
try to close the template: it asks me if i want to save the changes, but i
haven't made any changes.
How can i solve this problem?
Marco Mendonça - 21 Apr 2005 19:30 GMT
I realize that if i add "Templates(1).Saved=True" after running the startup
Macros, it all works fine. My question is: Is this the only way to acomplish
this?

> I've made a template which runs some macros automatically when it's opened.
> So, when i open the template, the macros work fine. The problem is when i
> try to close the template: it asks me if i want to save the changes, but i
> haven't made any changes.
> How can i solve this problem?
Charles Kenyon - 21 Apr 2005 23:33 GMT
Well, your code _is_ making some changes. Are you doing anything with
toolbars or menus?

Why are you opening the template rather than creating documents from it? The
proper way to use templates is usually to create new documents based on the
template.

Signature

Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide

See also the MVP FAQ: http://www.mvps.org/word which is awesome!
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.

> I've made a template which runs some macros automatically when it's
> opened.
> So, when i open the template, the macros work fine. The problem is when i
> try to close the template: it asks me if i want to save the changes, but i
> haven't made any changes.
> How can i solve this problem?
Marco Mendonça - 22 Apr 2005 10:59 GMT
Yes, i'm hiding and creating toolbars and menus.
The reason why i'm opening the template is the following: i'm launching word
from a .NET application; i need to create new documents in a "customized"
word environment (that's why i'm using macros). To acomplish this, i've
followed instructions from microsoft:  
http://msdn2.microsoft.com/library/hhf98b5c(en-us,vs.80).aspx

Is this not correct?

> Well, your code _is_ making some changes. Are you doing anything with
> toolbars or menus?
[quoted text clipped - 9 lines]
> > haven't made any changes.
> > How can i solve this problem?
Charles Kenyon - 22 Apr 2005 13:23 GMT
I'm not saying it is correct or incorrect, simply that you have made
changes. When you do so, it is very important that you set the customization
context for your changes. You want them stored in your document or your
template, not in normal.dot.

If possible, construct your own template with your customizations and use
that template for new documents. This will give you a customized environment
for your documents without having any effect on the user's interface. Making
changes in normal.dot, even if you mark its saved property to true will
eventually cause real changes to normal.dot unless your application closes
Word when it finishes. This is because even though your changes won't
trigger a prompt to save normal.dot or be saved by your application, if the
user makes independent changes such as updating a style or recording a macro
after your application runs, when the users changes to normal are saved,
yours will be to. Commercial Add-Ins (including at least one from Microsoft)
have added multiple copies of menu commands to Word's menus because of this.
Signature

Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide

See also the MVP FAQ: http://www.mvps.org/word which is awesome!
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.

> Yes, i'm hiding and creating toolbars and menus.
> The reason why i'm opening the template is the following: i'm launching
[quoted text clipped - 23 lines]
>> > haven't made any changes.
>> > How can i solve this problem?
Charles Kenyon - 22 Apr 2005 13:26 GMT
The article you reference also shows the method to create new documents
based on your own custom template. I suggest that you explore this. Build
your customizations into your template in advance, not a part of your code.

Again, you do not want to be opening a template. You want to be using the
documents.add method referencing your template instead.
Signature

Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide

See also the MVP FAQ: http://www.mvps.org/word which is awesome!
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.

> Yes, i'm hiding and creating toolbars and menus.
> The reason why i'm opening the template is the following: i'm launching
[quoted text clipped - 23 lines]
>> > haven't made any changes.
>> > How can i solve this problem?
Marco Mendonça - 22 Apr 2005 15:55 GMT
I'm doing exactly what you've said and accordingly with the referenced
article. I've built a template and made the customization there. Then i open
it as described in the article. I never "touched" Normal.dot, exactly because
of what you explained.

Anyways, the problem is solved.

Thanks for the attention...

> The article you reference also shows the method to create new documents
> based on your own custom template. I suggest that you explore this. Build
[quoted text clipped - 29 lines]
> >> > haven't made any changes.
> >> > How can i solve this problem?
Charles Kenyon - 22 Apr 2005 16:27 GMT
Don't want to beat a dead horse here, but opening a template and creating a
new document based on the template are different things. When a document is
created based on the template it is loaded, but not open. You can't find it
on your Word screen. When it is open, you can type in it.
Signature

Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide

See also the MVP FAQ: http://www.mvps.org/word which is awesome!
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.

> I'm doing exactly what you've said and accordingly with the referenced
> article. I've built a template and made the customization there. Then i
[quoted text clipped - 45 lines]
>> >> > haven't made any changes.
>> >> > How can i solve this problem?
Marco Mendonça - 22 Apr 2005 16:56 GMT
That's a fact...

> Don't want to beat a dead horse here, but opening a template and creating a
> new document based on the template are different things. When a document is
[quoted text clipped - 49 lines]
> >> >> > haven't made any changes.
> >> >> > How can i solve this problem?
 
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.