AutoClose()

A

Alpha

To supress the Word message box popping up asking if user would like to save the document, I've added AutoClose(), a auto macro, in the VBA code. I also ran the selfcert.exe and set the appropriate secruity level..... Everyting seems to run just fine here at the office with Word 2000. I applied the same solution to the customer site who is running Word 2002 and the message pop up windows continue to popping up asking the user if would like to save the document.

Has anyone seen this before. I appreciate any help or idea to resolve this

Thanks,
Alpha
 
C

Charles Kenyon

How are changes to the document being generated? By you? By the user?

Is it a protected form?

You could simply put into your code at the end:

ActiveDocument.Saved = True

This gets rid of the prompt but doesn't prevent the user from saving without
it.
--

Charles Kenyon

Word New User FAQ & Web Directory:
<URL: http://addbalance.com/word/index.htm>

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

See also the MVP FAQ: <URL: 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.

Alpha said:
To supress the Word message box popping up asking if user would like to
save the document, I've added AutoClose(), a auto macro, in the VBA code. I
also ran the selfcert.exe and set the appropriate secruity level.....
Everyting seems to run just fine here at the office with Word 2000. I
applied the same solution to the customer site who is running Word 2002 and
the message pop up windows continue to popping up asking the user if would
like to save the document.
 
A

Alpha

Hi Charles,
Thanks for the prompt reply. Basicly, the user runs our applicaton which invokes a Word template (we have VBA code in these templates that the user runs) and it prints the documents either with preview or no-preview. If I put the statment Activedocument.Saved = TRUE at the end of our VBA code then it still pops up the message window asking to save the doc or not. The only time it doesn't ask is if you preview the doc and made no changes and don't click to print.

I created and inserted the following auto macros and inserted into our code at the beginning afterthe variable delcaration part:
sub Autoclose(
Activedocument.saved = TRU
end su

This would work in our office when I ran tests. It supresses the pop up message window. I tried printing, changing the document then close the Word applicaiton and no message box would pop up. I applied this solution to the customer system and it doesn't work.

Also, These templates with VB codes are digitally signed and the Macro->Secrutiy setting is set as high and accepts this Digital Signed Macros.

I appreciate any input you have to help me sort this out

Thanks,
Alpha
 
C

Charles Kenyon

Don't put it in the AutoClose macro.

Put it in a macro that intercepts the print commands. Print is updating
fields in your document (making changes).

There is a page on the vba faq of the MVP FAQ site on intercepting commands.
You would need to intercept the FilePrint and (I think) FilePrintDefault
commands.

If your generated document is never saved, save it to something like
deleteme.dot (overwriting existing file) in your code.

Note, I'm over my head here and tossing off speculations and ideas, not
things I've done.
--

Charles Kenyon

Word New User FAQ & Web Directory:
<URL: http://addbalance.com/word/index.htm>

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

See also the MVP FAQ: <URL: 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.

Alpha said:
Hi Charles,
Thanks for the prompt reply. Basicly, the user runs our applicaton which
invokes a Word template (we have VBA code in these templates that the user
runs) and it prints the documents either with preview or no-preview. If I
put the statment Activedocument.Saved = TRUE at the end of our VBA code then
it still pops up the message window asking to save the doc or not. The only
time it doesn't ask is if you preview the doc and made no changes and don't
click to print.
I created and inserted the following auto macros and inserted into our
code at the beginning afterthe variable delcaration part:
sub Autoclose()
Activedocument.saved = TRUE
end sub

This would work in our office when I ran tests. It supresses the pop up
message window. I tried printing, changing the document then close the Word
applicaiton and no message box would pop up. I applied this solution to the
customer system and it doesn't work.
Also, These templates with VB codes are digitally signed and the
Macro->Secrutiy setting is set as high and accepts this Digital Signed
Macros.
 
C

Charles Kenyon

Many corporate environments are set to disable all macros. Signing a project
with a selfcert certificate won't solve this. You need an actual developers
certificate.

If your template is in one of the templates folders recognized by Word,
security can be set to allow macros without a certificate.
--

Charles Kenyon

Word New User FAQ & Web Directory:
<URL: http://addbalance.com/word/index.htm>

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

See also the MVP FAQ: <URL: 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.

Alpha said:
Thanks Charles, but maybe my notes earlier wasn't not clear. You see, the
code I put in the Autoclose works here in our office. It only stop working
when I applied it to our customer's system. It's like there's another
switch outside of Word that overwrites the setting in Word and dis-able all
Macro.
 
A

Alpha

Ok, I connected to look at the certification of the macro in the template at our customer site. I click on the detail button and got the following message" This CA root certificat is not trusted because it is not in the Trusted Root Certification authorties store."

I think you're right about placing this template in the correct directory. Please tell me which directory I should try placing it in or point me to some where to look it up. I tried the 2 links you provided but found nothing.

Thanks,
Alpha
 
C

Charles Kenyon

You want it in the user templates folder or the workgroup templates folder.
Where these are depends on (1) user settings or network policies, (2) the
version of Word, and (3) the operating system. If you tell me all three of
these, I may be able to give you a good guess as to where they are. Looking
under Tools => Options => File Locations would be quicker, though. For more
on the different kinds of templates and locations of templates folders see
<URL: http://addbalance.com/usersguide/templates.htm>.
--

Charles Kenyon

Word New User FAQ & Web Directory:
<URL: http://addbalance.com/word/index.htm>

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

See also the MVP FAQ: <URL: 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.


Alpha said:
Ok, I connected to look at the certification of the macro in the template
at our customer site. I click on the detail button and got the following
message" This CA root certificat is not trusted because it is not in the
Trusted Root Certification authorties store."
I think you're right about placing this template in the correct directory.
Please tell me which directory I should try placing it in or point me to
some where to look it up. I tried the 2 links you provided but found
nothing.
 
A

Alpha

Hi Charles,
The customer's Workgroup fodler path was blank so I added the path where the template resides. I ran it and now it won't pop up the message when you just edit the document then click to close but it still pop up the msg window when I print the document then close. At my system here it doesn't pop up the msg box either way

I don't know if I mentioned that I use Word 2000 while the customer is using Word 2002. We are both running Windows 2000 Server

Thanks,
Alpha
 
C

Charles Kenyon

Try intercepting the print commands in your template.
--

Charles Kenyon

Word New User FAQ & Web Directory:
<URL: http://addbalance.com/word/index.htm>

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

See also the MVP FAQ: <URL: 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.

Alpha said:
Hi Charles,
The customer's Workgroup fodler path was blank so I added the path where
the template resides. I ran it and now it won't pop up the message when you
just edit the document then click to close but it still pop up the msg
window when I print the document then close. At my system here it doesn't
pop up the msg box either way.
I don't know if I mentioned that I use Word 2000 while the customer is
using Word 2002. We are both running Windows 2000 Server.
 
A

Alpha

I put a msgbox at the AutoClose sub and it is popping up after the unwanted message box about saving the current file. The unwanted msg box occured after the command Application.PrintOut. How do I intercept the printout method to stop the unwanted message box? thanks.
 
C

Charles Kenyon

If, at this point in your macros you have already saved the document, put an
ActiveDocument.Saved = True command in just before the automatic message box
is generated. You'll have to step through your procedure to see when this
is.

BTW, I'm _way_ over my head here. I'm just a beginner myself at vba.


Alpha said:
I put a msgbox at the AutoClose sub and it is popping up after the
unwanted message box about saving the current file. The unwanted msg box
occured after the command Application.PrintOut. How do I intercept the
printout method to stop the unwanted message box? thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top