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.
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,
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!
_________
Groetjes,
Joost Verdaasdonk
M.O.S. Master
Mark your thread solved, when it has been, by hitting the Thread Tools dropdown at the top of the thread.
(I don't answer questions asked through E-mail or PM's)
Ahh.. that's why I couldnt find it on MSDN.. was looking at naming conventions, not captions.
That's exactly what I wanted, Thanks!
Hi Lev,
Ah great...you're welcome!
_________
Groetjes,
Joost Verdaasdonk
M.O.S. Master
Mark your thread solved, when it has been, by hitting the Thread Tools dropdown at the top of the thread.
(I don't answer questions asked through E-mail or PM's)