Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
Suzanne S. Barnhill
 
Posts: n/a
Default 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

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
macros and SharePoint WSS document libraries [email protected] New Users 0 October 6th 05 03:42 AM
Linking from IE5+ to specific portion of Word document sicklyscott Microsoft Word Help 4 April 18th 05 06:46 PM
Autotext entry does not save Padraig Microsoft Word Help 1 February 13th 05 11:34 PM
Autotext. I want a subdocuments name in the master document petermichaux Microsoft Word Help 1 February 13th 05 02:38 AM
auto current date entry in your document SDecou Microsoft Word Help 1 December 30th 04 10:47 PM


All times are GMT +1. The time now is 05:11 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"