Consulting

Results 1 to 4 of 4

Thread: Solved: Naming New Document

  1. #1
    VBAX Regular
    Joined
    Apr 2005
    Posts
    27
    Location

    Solved: Naming New Document

    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.

  2. #2
    Administrator
    VP-Knowledge Base
    VBAX Guru MOS MASTER's Avatar
    Joined
    Apr 2005
    Location
    Breda, The Netherlands
    Posts
    3,281
    Location
    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)

  3. #3
    VBAX Regular
    Joined
    Apr 2005
    Posts
    27
    Location
    Ahh.. that's why I couldnt find it on MSDN.. was looking at naming conventions, not captions.

    That's exactly what I wanted, Thanks!

  4. #4
    Administrator
    VP-Knowledge Base
    VBAX Guru MOS MASTER's Avatar
    Joined
    Apr 2005
    Location
    Breda, The Netherlands
    Posts
    3,281
    Location
    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)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •