Filename part

  • Thread starter Thread starter Guest
  • Start date Start date
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

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
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

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
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?
 
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?
 
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

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
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

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
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!
 
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!
 
Back
Top