programing 'filename'

M

mlh923

Is it possible to program a text 'field' so that the text that is entered
will atomatically be the filename of the doc??? If so how, If not WHY?
 
J

Jezebel

Write a macro called FileSave -- this will run in place of the built-in
command. Check if the file has never before been saved: if not, retrieve the
text from the field and use that as the argument to the SaveAs command.
 
J

Jean-Guy Marcil

Bonjour,

Dans son message, < mlh923 > écrivait :
In this message, < mlh923 > wrote:

|| Is it possible to program a text 'field' so that the text that is entered
|| will atomatically be the filename of the doc??? If so how, If not WHY?

How about a { FILENAME } field?

Use CTRL-F9 to insert the { } and then type FILENAME between the two { }.

Or see the list of field available in Insert > Fields...

Or use the Header/Footer toolbar to insert it (The Autotext list to the
left).
--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
M

mlh923

To explain more clearly. I would like to have a variable field in a template
that will save each new doc as the revision number typed into a text field.
Each new doc will be saved as a different number. Can I program word to
locate filename in a variable field??
 
J

Jezebel

mlh923 said:
To explain more clearly. I would like to have a variable field in a template
that will save each new doc as the revision number typed into a text field.
Each new doc will be saved as a different number. Can I program word to
locate filename in a variable field??

Depends what you mean by 'variable field'. You can assign a bookmark to any
range of your document; your macro can then retrieve the contents of that
bookmark. You can insert a formfield into the document, and your code can
retrieve that. You might find it easier still to use a DocProperty field,
which makes for a little more work when you create the filename in the first
place, but is even easier to work with from code.
 
U

Ulf Nilsson

Hi,
Where can I find all these macro-names which will nun in
place of the built-in command?

/ Ulf
 
J

Jezebel

Go to Tools > Macro, and select "Word commands" from the 'Macros In' list.
As you'll see, many of them are the menu name plus the command name (eg
FileSave, EditCopy, etc).
 
G

Graham Mayor

A simple method pointed out recently by fellow MVP Herb Tyson in another ng
is to use CTRL+ALT+( the + sign from the numeric keypad). This gives a
cursor that looks like a square with a circle at each corner. Select the
command you are interested in and the customize keyboard dialog opens at the
appropriate command name.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top