PDA

View Full Version : Solved: Naming New Document



Levski
05-01-2005, 10:25 AM
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.

MOS MASTER
05-01-2005, 10:46 AM
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:
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

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:

Levski
05-01-2005, 10:51 AM
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:

MOS MASTER
05-01-2005, 11:07 AM
Hi Lev, :D
Ah great...you're welcome! :beerchug: