S
Sammy
Hello,
I'm trying to create a macro that forces autotext entries to be saved in a
special template called User.dot instead of Normal.dot. I have the macro
tied to Alt+F3, this is how the users will save their autotext. Here's what
I have so far, the message boxes work but it still won't save the autotext
entry in the User.dot:
Sub UserAutoText()
Dim SelectText As Range
Dim AutoTextEntry As AutoTextEntry
Dim myTemplate As Template
Application.ScreenUpdating = False
On Error GoTo Quit
Set SelectText = Selection.Range
If SelectText = "" Then
MsgBox ("You Must Select Text First"), vbOKOnly + vbCritical, "Save
AutoText Entry"
Else: GoTo CreateAutoText
End If
GoTo Quit
CreateAutoText:
AutoTextEntry = InputBox("Word will save an AutoText entry from the current
selection in your User.dot. Please name your AutoText entry and then press
Enter.", Title:="AutoText Entry")
If AutoTextEntry = "" Then GoTo Quit
Dialogs(wdDialogFileOpen).Show
Documents.Open FileName:="C:\Program Files\Microsoft
Office\Office10\Startup\User.dot"
Set myTemplate = ActiveDocument.AttachedTemplate
myTemplate.AutoTextEntries.Add Name:=AutoTextEntry, _
Range:=SelectText
ActiveDocument.Save
ActiveDocument.Close
Quit:
Application.ScreenUpdating = True
End Sub
ANY IDEAS? THANK YOU FOR YOUR ASSISTANCE AND HAPPY HOLIDAYS.
I'm trying to create a macro that forces autotext entries to be saved in a
special template called User.dot instead of Normal.dot. I have the macro
tied to Alt+F3, this is how the users will save their autotext. Here's what
I have so far, the message boxes work but it still won't save the autotext
entry in the User.dot:
Sub UserAutoText()
Dim SelectText As Range
Dim AutoTextEntry As AutoTextEntry
Dim myTemplate As Template
Application.ScreenUpdating = False
On Error GoTo Quit
Set SelectText = Selection.Range
If SelectText = "" Then
MsgBox ("You Must Select Text First"), vbOKOnly + vbCritical, "Save
AutoText Entry"
Else: GoTo CreateAutoText
End If
GoTo Quit
CreateAutoText:
AutoTextEntry = InputBox("Word will save an AutoText entry from the current
selection in your User.dot. Please name your AutoText entry and then press
Enter.", Title:="AutoText Entry")
If AutoTextEntry = "" Then GoTo Quit
Dialogs(wdDialogFileOpen).Show
Documents.Open FileName:="C:\Program Files\Microsoft
Office\Office10\Startup\User.dot"
Set myTemplate = ActiveDocument.AttachedTemplate
myTemplate.AutoTextEntries.Add Name:=AutoTextEntry, _
Range:=SelectText
ActiveDocument.Save
ActiveDocument.Close
Quit:
Application.ScreenUpdating = True
End Sub
ANY IDEAS? THANK YOU FOR YOUR ASSISTANCE AND HAPPY HOLIDAYS.