Logo 
Search:

MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

Hyperlink from Excel to a MSWord Template...not coming up doc ?

  Asked By: Lorraine    Date: Mar 01    Category: MS Office    Views: 1930
  

I am putting together an excel worksheet list of required documents for our
project team. The goal is to simplify launching the correct document template
required. I know how to create a hyperlink and the hyperlink does launch the
proper document. However, MSWord templates when double clicked should launch a
new document that needs to be saved; maintaining the integrity of the word
template.
My problem is that the template comes up as a template file (.dot) instead of as
a document file (.doc) as it should. I have spent half the day searching for an
answer to this and found that you can hyperlink (from a word document) to a
shortcut to a word template and that is supposed to solve the problem. When I
created this solution, it just locked up word. Not the real problem since we
want this to be resolved from and Excel spreadsheet.

This same proposed solution, however, did not resolve the issue from Excel. IE:
When I hyperlinked from Excel to a shortcut to a word template, the word
template still came up and not the doc. We need the word template to work
correctly launching the template as a new .doc document.

Share: 

 

1 Answer Found

 
Answer #1    Answered By: Cedric Sanders     Answered On: Mar 01

You can modify the Word Templates to force them to always open as New
Documents by sticking this code into the Document_Open event.

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 ACCIDENTALLY
'ACCESS MASTER TEMPLATE DESIGN
'********************************************

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

End Sub

 




Tagged: