In VBA you can get the file name from ActiveDocument.Name and can strip out
your date in many ways. One way ..
myWords = Split(Split(ActiveDocument.Name, ".")(0))
myDate = myWords(Ubound(myWords))
If you have done this in Excel you can probably use the same code in Word,
except for using ActiveDocument instead of ActiveWorkbook.
I'm not sure what you are asking about Fields.
--
Enjoy,
Tony
> I have a file name with a date in it (FILENAME 051006.doc) and I want to
> automatically update a section of the document with the date that's in the
[quoted text clipped - 3 lines]
> Thanks in advance,
> Barb Reinhardt
Barb Reinhardt - 03 Oct 2005 19:55 GMT
Tony,
I've taken what you suggested and am trying to learn what else I need to do.
I'm not terribly experienced with VBA. I have this so far:
strDoc = ActiveDocument.Name
strDoc = "WE 050930 Report" <---testing with a known string
myWords = Split(strDoc, " ") <---Wrong number of arguments or invalid
property assignment
Dim i
For i = 0 To UBound(myWords)
Response.Write i & " = " & myWords(i) & "<BR>"
Next
What am I doing wrong.
Thanks!
> In VBA you can get the file name from ActiveDocument.Name and can strip out
> your date in many ways. One way ..
[quoted text clipped - 19 lines]
> > Thanks in advance,
> > Barb Reinhardt
Tony Jollans - 03 Oct 2005 20:10 GMT
Hi Barb,
I cut and pasted your code and the Split worked fine.
The Response.Write however isn't Word VBA,, and the "<BR"> makes me
suspicious. Where are you trying to run this?
--
Enjoy,
Tony
> Tony,
>
[quoted text clipped - 39 lines]
> > > Thanks in advance,
> > > Barb Reinhardt