![]() |
#1
|
|||
|
|||
![]()
Hi,
I have some Word documents saved as Macro-Enabled Templates. If users go to the folder and open the document they get a new copy as expected. If I Hyperlink to the same documents when they click the hyperlink they open the original document and can over write it. Is there a way to hyperlink and generate a copy and not open the original? Thank you |
#2
|
|||
|
|||
![]()
A hyperlink simply takes the user to the target. It is not the same as double-clicking on a template.
You can create a macro either by recording or writing it to create a new document based on the template. You can further use a MacroButton field to run the macro. It can be formatted as a hyperlink. The first step in the macro, though, should be to collapse the selection because when a macro-button field is clicked on, the field is selected. It will require a double-click to activate unless you set the option for a single-click. Here is more on these fields: |
#3
|
|||
|
|||
![]() Quote:
That is really annoying, thank you very much for your help. |
#4
|
|||
|
|||
![]()
Here are a macro that creates a new document based on a template and the function that helps set the path to find the template. (You can hard code the path instead, if you want. This one gets templates from my Workgroup Templates folder.)
Code:
Sub KenyonBill() ' ' KenyonBill Macro ' Macro written 7/5/02 by Charles Kyle Kenyon ' "&chr(10)&"New letter based on Kenyon Letterhead form ' Calls WorkgroupPath Function (below) ' Dim sTemplatesPath As String sTemplatesPath = WorkGroupPath & "Menus\Office Forms" Documents.Add Template:= _ sTemplatesPath & "Kenyon Bill Form.dotm" _ , NewTemplate:=False End Sub Code:
Function WorkGroupPath() As String ' Written by Charles Kenyon ' February 28, 2003 ' ' Used by templates menus to set location of templates. ' Returns workgroup tempates path with "" at the end. ' ' This is needed because if the folder is a network drive rather ' than a folder, it will have the "" already. If it is a folder, ' it will not have the backslash. This function gives a string ' with the backslash in either case. ' WorkGroupPath = Application.Options.DefaultFilePath(wdWorkgroupTemplatesPath) If Right(WorkGroupPath, 1) <> "" Then WorkGroupPath = WorkGroupPath & "" End If End Function Code:
Selection.Collapse You need to have the following command in an AutoMacro. This can be in your normal template or a document template. Without this, it takes a double-click to run the macro. Code:
Options.ButtonFieldClicks = 1 Code:
Sub AutoExec({) Options.ButtonFieldClicks = 1 End Sub Modifying the Quick Access Toolbar (QAT) in Microsoft Word |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
KodosLives | Word | 4 | 02-06-2023 01:25 AM |
Macro enabled Excel forms | Ricco49 | Excel Programming | 2 | 11-01-2017 04:04 AM |
Word 2010 Macro Enabled Template with Content Controls | keen1598 | Word VBA | 7 | 01-29-2014 03:17 PM |
![]() |
delete123 | PowerPoint | 2 | 04-10-2013 05:38 AM |
![]() |
ReviTULize | Word VBA | 4 | 02-01-2013 01:46 PM |