Filename part

G

Graham Mayor

With a macro?

Sub InsertFnameOnly()
Dim pPathname As String
With ActiveDocument
If Not .Saved Then
.Save
End If
pPathname = Left$(.Name, (Len(.Name) - 4))
End With
Selection.TypeText pPathname
End Sub

http://www.gmayor.com/installing_macro.htm

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

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
G

Graham Mayor

With a macro?

Sub InsertFnameOnly()
Dim pPathname As String
With ActiveDocument
If Not .Saved Then
.Save
End If
pPathname = Left$(.Name, (Len(.Name) - 4))
End With
Selection.TypeText pPathname
End Sub

http://www.gmayor.com/installing_macro.htm

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

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
G

Guest

Txs Graham!

It works with a macro, but I've to run it each time I want to update the
filename.

I want something more automatic.

It isn't possible with a field code?

Or there is some away to run the macro automatically?
 
G

Guest

Txs Graham!

It works with a macro, but I've to run it each time I want to update the
filename.

I want something more automatic.

It isn't possible with a field code?

Or there is some away to run the macro automatically?
 
G

Graham Mayor

You can't do it with field codes (unless you turn off the Windows Explorer
display of filename extensions - which is probably not a good plan - and in
any case the field will not update automatically)

Why are you changing the filename? Create a template - create new documents
from that template and use the code as an autonew macro in that template to
add the filename to each document as it is created. DON'T add it to
normal.dot!!

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

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
G

Graham Mayor

You can't do it with field codes (unless you turn off the Windows Explorer
display of filename extensions - which is probably not a good plan - and in
any case the field will not update automatically)

Why are you changing the filename? Create a template - create new documents
from that template and use the code as an autonew macro in that template to
add the filename to each document as it is created. DON'T add it to
normal.dot!!

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

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
G

Guest

In fact, this was for a fax template.

In our case, every fax has a sequencial number, like F2006.xxx, which is
saved in a specific path.

In the top of the fax we put our reference, that corresponds to the file
name F2006.xxx.

If it isn't possible with field codes, I agree with you in create a macro.

Now help me please, with another thing... in this case, there are only files
like F2006001.doc, F2006002.doc, ..., saved in that path.

Is it possible with a code, check what is the last file in that path?


Thanks in advance!
 
G

Guest

In fact, this was for a fax template.

In our case, every fax has a sequencial number, like F2006.xxx, which is
saved in a specific path.

In the top of the fax we put our reference, that corresponds to the file
name F2006.xxx.

If it isn't possible with field codes, I agree with you in create a macro.

Now help me please, with another thing... in this case, there are only files
like F2006001.doc, F2006002.doc, ..., saved in that path.

Is it possible with a code, check what is the last file in that path?


Thanks in advance!
 

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