[mso] Re: Open Word Template In File/New Format

  • From: "Dian Chapman" <dian@xxxxxxxxxxxxx>
  • To: <mso@xxxxxxxxxxxxx>
  • Date: Tue, 30 Dec 2003 00:41:41 -0600

This code will do the job for you...but sorry, don't have time to teach you
how to use it. You can read this article for details: 

Sharing Macros:
http://pubs.logicalexpressions.com/Pub0009/LPMArticle.asp?ID=166

And kudos to Greg who wrote this code for me for a project many years ago.
Great stuff, my dear! ;-)

Note...if you need further help with the VBA code, you might want to join my
Word_VBA group where a couple hundred other folks writing code might be able
to provide more help. Sorry I can't...but it's TechTrax time<smile>...and I
have a magazine to publish! Here's the info URL to the VBA group:

http://groups.yahoo.com/group/Word_VBA/

Or you can post to the Microsoft free support groups at:
http://support.microsoft.com/newsgroups

Just drill down to the Word VBA group for help. Here's another article if
you decide to go this route and need more help/info about using the
newsgroups.

How To Get Help
http://www.computorcompanion.com/LPMArticle.asp?ID=124

Good luck! (see below for VBA code to copy into your ThisDocument module of
your template.


Private Sub Document_Open()

'this code is for template and prevents
'the user from accidentally opening template
'in development mode...create standard document

'turns off repagination and screen updating
'to allow automation to work faster and
'less chance of template corruption or
'crashing

Options.Pagination = False
Application.ScreenUpdating = False

Dim intDocumentType
Dim strTemplateName As String
Dim strTemplatePath As String

'The following allows the entire project
'to know which template is being worked with
'and it's path. This prevents from having
'to place the template in a specific
'Word template directory. Both are Globals

'gets the full path/name of the active template
strTemplateName = Templates(1).FullName

'gets Path to Template and pads with "\" if required
strTemplatePath = Templates(1).Path
If Right(strTemplatePath, 1) <> Application.PathSeparator Then
    strTemplatePath = strTemplatePath & Application.PathSeparator
End If

intDocumentType = ActiveDocument.Type

'*******************************************
'COMMENT OUT ALL INDENTED CODE BELOW WHEN WORKING
'ON TEMPLATE IN DESIGN MODE OR CHANGES
'WON'T BE PROPERLY SAVED. TURN IT BACK ON
'FOR FINAL SO USER CAN'T ACCIDENTIALLY
'ACCESS MASTER TEMPLATE DESIGN
'********************************************

        If intDocumentType = 1 Then
            Documents.Add Template:=strTemplateName
            Documents(strTemplateName).Close SaveChanges:=wdDoNotSaveChanges
        End If

End Sub
 


Dian D. Chapman
Technical Consultant, 
Microsoft MVP & Instructor

Free Tutorials: www.mousetrax.com/techtrax
Free Word Tips & Tricks eBook: www.mousetrax.com/books.html
Learn VBA the easy way, thru video! www.mousetrax.com/techcourses.html

  


-----Original Message-----
From: mso-bounce@xxxxxxxxxxxxx [mailto:mso-bounce@xxxxxxxxxxxxx] On Behalf
Of Cathy.Evans@xxxxxxxxx
Sent: Monday, December 29, 2003 10:10 AM
To: MS Office
Subject: [mso] Open Word Template In File/New Format


Can anyone show me how to write something into my Word template that will
cause it under any circumstances to open in file/new format and is there a
down side to setting this up in a document?


 

                    Cathy Evans

                    12/18/2003           To:     mso@xxxxxxxxxxxxx

                    04:54 PM

                                         cc:

 

                                         Subject:     Re: [mso] Re: Open
Access OLE Word Doc as Template(Document   
                                          link: Cathy Evans)...

 

 
..... 
 




Sorry to be so long in reply, this project got temporarily put aside for
other workload.  Are you talking about the Document_Open of Microsoft Word
or on the Microsoft Access side.  My explanation was bad, it's not the
opening as a doc that is a problem, it's that when Access opens the Word
document it opens the template as if you were opening from the file/open
menu in Word instead of opening as file/new.  This causes the automation in
the form to not activate.  I'm not finding on the Access side how to
accomplish this and do not know visual basic on the Word side.  I am barely
making my way through learning Access code by trial and error, so I'm
needing help on the Access side if possible, cause I am very lost in Word.
Also, I've got merge fields in some of the Word forms I'm using that feed
from the Access side, however, is there a way to pass that field data into
the Word form when you open it, thereby doing away with the merge and still
accomplishing the data portion.  Thank you, Cathy


 

                    "Dian Chapman"

                    <dian@mousetrax      To:     <mso@xxxxxxxxxxxxx>

                    .com>

                    Sent by:             cc:

                    mso-bounce@free

                    lists.org            Subject:     [mso] Re: Open Access
OLE Word Doc as Template                
                    12/14/2003

                    04:47 AM
..... 
                    Please respond

                    to mso

 

 





Templates are SUPPOSED to open as docs. Just add the automation into the
Document_New event to get it to fire properly. It's probably in the
Document_Open or Auto_Open/Exec events. It should be in the Document_New
event.


Dian D. Chapman
Technical Consultant,
Microsoft MVP & Instructor

Free Tutorials: www.mousetrax.com/techtrax Free Word Tips & Tricks eBook:
www.mousetrax.com/books.html Learn VBA the easy way, thru video!
www.mousetrax.com/techcourses.html

-----Original Message-----
From: mso-bounce@xxxxxxxxxxxxx [mailto:mso-bounce@xxxxxxxxxxxxx] On Behalf
Of Cathy.Evans@xxxxxxxxx
Sent: Sunday, December 14, 2003 12:35 AM
To: mso@xxxxxxxxxxxxx
Subject: [mso] Open Access OLE Word Doc as Template


Hello, I have an Access 97 database with linked .dot forms.  Clicking the
link opens them in Word as documents, not templates, causing loss of the
automation built into the forms.  Have tried embedding as OLE instead of
link but it still opens .dot as .doc.  Have been searching the net for code
solutions but no answers. Can anyone help?  Thank you! :)






----------------------------------------------------------------------------
-------------------------
The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. If you are not the intended recipient of this message you are
hereby notified that any use, review, retransmission, dissemination,
distribution, reproduction or any action taken in reliance upon this message
is prohibited. If you received this in error, please contact the sender and
delete the material from any computer.  Any views expressed in this message
are those of the individual sender and may not necessarily reflect the views
of the company.  
----------------------------------------------------------------------------
---------------------------

*************************************************************
You are receiving this mail because you subscribed to mso@xxxxxxxxxxxxx or
MicrosoftOffice@xxxxxxxxxxxxxxxx

To send mail to the group, simply address it to mso@xxxxxxxxxxxxx

To Unsubscribe from this group, send an email to mso-request@xxxxxxxxxxxxx
with the word "unsubscribe" (without the quotes) in the subject line.

Or, visit the group's homepage and use the dropdown menu.  This will also
allow you to change your email settings to digest or vacation (no mail).
//www.freelists.org/webpage/mso

To be able to use the files section for sharing files with the group, send a
request to mso-moderators@xxxxxxxxxxxxx and you will be sent an invitation
with instructions.  Once you are a member of the files group, you can go
here to upload/download files:
http://www.smartgroups.com/vault/msofiles
*************************************************************

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.554 / Virus Database: 346 - Release Date: 12/20/2003
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.554 / Virus Database: 346 - Release Date: 12/20/2003
 

*************************************************************
You are receiving this mail because you subscribed to mso@xxxxxxxxxxxxx or 
MicrosoftOffice@xxxxxxxxxxxxxxxx

To send mail to the group, simply address it to mso@xxxxxxxxxxxxx

To Unsubscribe from this group, send an email to 
mso-request@xxxxxxxxxxxxx with the word "unsubscribe" (without the quotes) in 
the subject line.

Or, visit the group's homepage and use the dropdown menu.  This will also allow 
you to change your email settings to digest or vacation (no mail).
//www.freelists.org/webpage/mso

To be able to use the files section for sharing files with the group, send a 
request to mso-moderators@xxxxxxxxxxxxx and you will be sent an invitation with 
instructions.  Once you are a member of the files group, you can go here to 
upload/download files:
http://www.smartgroups.com/vault/msofiles
*************************************************************

Other related posts: