Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Linking an autotext entry to the author of a document
If you pasted the entire macro including the lines
Sub ScratchMacro() and End Sub then you've got two macro names and two macro routine end points. -- Suzanne S. Barnhill Microsoft MVP (Word) Words into Type Fairhope, Alabama USA Word MVP FAQ site: http://word.mvps.org Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit. "DP" wrote in message ... Hi Greg Thanks for your reply. It didn't work, but I don't think I did it correctly either. Here's what I did: I created a macro called AutoNew and copied and pasted the macro listing that you providing. Strangly, after I did this the toggle objects were not working so I had to delete the template and re-install. It works now, but obviously something went wrong. Dawn "Greg" wrote: Dawn, First do you want the name to change for every user that "opens" the document or for the name to be inserted when a user "creates" the document for the first time? I am going to assume the latter as it makes more sense. You will need an AutoNew macro in your Template Project. See: http://www.gmayor.com/installing_macro.htm You could use this code: Sub ScratchMacro() Dim oRng As Range Dim pUserName As String pUserName = Application.UserName Set oRng = ActiveDocument.Bookmarks("SigBlock").Range ActiveDocument.AttachedTemplate.AutoTextEntries(pU serName).Insert Whe=oRng End Sub You will need to have a bookmark in the template named SigBlock. You will need to have an AutoText entry defined for each user that you expect to create a document from this template that matches "exactly" the UserName. For example, my UserName is Gregory K. Maxey and I have and AutoText entry named Gregory K. Maxey The code code be enhanced with a bit of error handling in case a new user came along before you had a chance to update the macro, but we can save that for lesson two. Actually I suppose that some wizard may come alone and suggest that you could somehow scan your server and automatically create the autotext entries for the registered UserNames, but that is graduate level work and way, way over my head. |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
macros and SharePoint WSS document libraries | New Users | |||
Linking from IE5+ to specific portion of Word document | Microsoft Word Help | |||
Autotext entry does not save | Microsoft Word Help | |||
Autotext. I want a subdocuments name in the master document | Microsoft Word Help | |||
auto current date entry in your document | Microsoft Word Help |