A
Anders F
How can I get the document file name? I want to set it in the header but I
can not do it. This is as far as I get (see below), when I try I get the
message
"The index into the specified collection is out of bounds." I suppose it is
Shapes that is the culprit, if I set Shapes(0) I get the same message.
I have used Word for some time but never for anything like this. According
to
Help, the source name does refere to a linked OLE object but I only have
one document, is it possible to declare it as an OLE object? Or is there
some other way to get the source file name?
Thanks for any answer
Sub MyInitDocument()
ActiveDocument.Sections(1).Headers(1).Range.Text = _
ActiveDocument.Shapes(1).LinkFormat.SourceName
End Sub
can not do it. This is as far as I get (see below), when I try I get the
message
"The index into the specified collection is out of bounds." I suppose it is
Shapes that is the culprit, if I set Shapes(0) I get the same message.
I have used Word for some time but never for anything like this. According
to
Help, the source name does refere to a linked OLE object but I only have
one document, is it possible to declare it as an OLE object? Or is there
some other way to get the source file name?
Thanks for any answer
Sub MyInitDocument()
ActiveDocument.Sections(1).Headers(1).Range.Text = _
ActiveDocument.Shapes(1).LinkFormat.SourceName
End Sub