Is there any way of creating a name for a document when adding to wordapp.documents rather than the standard name assigned (usually Document1).
I was not able to find a parameter of the MSDN site for this.
Thank you.
Printable View
Is there any way of creating a name for a document when adding to wordapp.documents rather than the standard name assigned (usually Document1).
I was not able to find a parameter of the MSDN site for this.
Thank you.
Hi, :D
Depends on what you're trying to do!
If you create a New document the window's caption will display: "Document x"
This is the caption off the window not the name of the document.
So if you mean this it can be easily altered when you make a new document:[vba]
Sub NameDoc()
Dim oApp As New Word.Application
With oApp
.Documents.Add
.Windows(1).Caption = "Hi I'm a new document"
.Visible = True
End With
Set oApp = Nothing
End Sub
[/vba]
If you really want to give you're document a name then you will have to save it first. (That's the moment a document gets his name)
If you need something else please provide more information.
Enjoy! :whistle:
Ahh.. that's why I couldnt find it on MSDN.. was looking at naming conventions, not captions.
That's exactly what I wanted, Thanks! :friends:
Hi Lev, :D
Ah great...you're welcome! :beerchug: