Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Larry
 
Posts: n/a
Default How to make doc's FullName into an AutoText entry without first inserting it into document


This macro works fine. It temporarily Inserts Fullname of the active
document into the document and makes that string an AutoText entry
called MyDocName, which is used later by another macro to reactivate
this document from another document. This enables me to return
instantly to this document without having to open the Window menu or
scroll through the open documents. But I wonder if there is a more
efficient way of doing it, so that the active document's FullName
doesn't actually have to be inserted into the document as a range, but
rather the FullName becomes an AutoText entry in one step. It seems
that would make the macro a little faster.

Any ideas? Thanks.
Larry
..

Sub DocFullNameStore()

Application.ScreenUpdating = False
Dim X As Long, Y As Long
Dim r As Range

X = ActiveDocument.Range.End - 1
ActiveDocument.Range.InsertAfter ActiveDocument.FullName
Y = ActiveDocument.Range.End - 1
Set r = ActiveDocument.Range(Start:=X, End:=Y)
NormalTemplate.AutoTextEntries.Add Name:="MyDocFullName", Range:=r
r.Delete

End Sub



 
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
simple word question rvance New Users 8 February 1st 05 02:16 AM
Autotext exclusive to a New Document Template I Create in Word 200 KM1 Microsoft Word Help 2 January 23rd 05 04:03 AM
auto current date entry in your document SDecou Microsoft Word Help 1 December 30th 04 10:47 PM
Inserting a hyperlink - Place in this document rhewell Microsoft Word Help 3 December 14th 04 03:49 AM
Using Hyperlinks in Mail Merge IF...THEN...ELSE Statements Mark V Mailmerge 8 November 30th 04 01:31 PM


All times are GMT +1. The time now is 09:08 PM.

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"