Hyperlink to bring up a template form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to have a log which has a hyperlink to a template form so you
can get a ID number and then get a blank form (from the template) and enter
the number.

I set up the hyperlink but it brings up the original document, not the blank
form which I need.

Thanks for your help.

Ed
 
I would modify your template so that it automatically opened as a new
document by adding the following code to it:

'*****Code Start*******************************

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



'*************Code
End**************************************************



If you need help in adding this code to your template, see
http://www.gmayor.com/installing_macro.htm making sure that the Macros
In has the name of your template listed.


--
Dawn Crosier
Microsoft MVP
"Education Lasts a Lifetime"

This message is posted to a newsgroup. Please post replies and
questions to the newsgroup so that others can learn as well.
 

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

Back
Top