Results 1 to 5 of 5
  1. #1
    Lounger
    Join Date
    Feb 2005
    Location
    Florida, USA
    Posts
    38
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi all,


    I've created a form in Word and everytime I click on the *.dot file the form is opened up as Document1.doc default filename.
    I usually save the document with a more representative filename, close the Document1 file and continue editing.

    I really would like to be prompted to Save As... the new document UPON double clicking the *.dot file so I wouldn"t have to face the deletion of Document1 file.

    Can anyone direct me how to add a VBA code to the *.dot file to achieve what I want?
    I tried to do so with a macro as well but couldn't figured it out.

    I'm using Word2003 running on winXP SP2.

    Thanks for any help!

    -Tivoli0

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    Do you mean that clicking the .dot file actually saves a document as Document1.doc?
    Normally, (double-)clicking a template starts a new document that hasn't been saved to disk yet.
    If the new document is saved automatically, the template probably contains VBA code that does this - look for code in the Document_New event procedure in the template's ThisDocument module, or for a macro named AutoNew in a standard template.
    Or did I misunderstand your description?

  3. #3
    Lounger
    Join Date
    Feb 2005
    Location
    Florida, USA
    Posts
    38
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi Hans,

    Thanks for replying!

    You're right, the Document1 is Being created WITHOUT the saving.

    I was able to get the prompt I was seeking. I entered in the filename.dot file the following code and have the first field in it to use the proc on entry:


    Sub SaveAsNewFile()

    Dim strDocName As String

    strDocName = InputBox("Please enter the name " & _
    "of your document.")
    ActiveDocument.SaveAs FileName:=strDocName

    End Sub


    So all is fine now, but I'm facing another issue now:

    In the filename.dot file's header I have specified to insert the filename. Although the filename.dot shows its true filename in the its header, the newly created *.doc document shows "Document1".

    How can I have the newly created document to show my assigned filename?

    Thanks again, Hans, for your assistance!

    -Tivoli0

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    If the new document is created without being saved - as is normal - why would you have to delete a file Document1.doc, as you originally mentioned? I don't understand where Document1.doc comes from.

    If you have a Filename field in the header, it will initially display Document1 or something similar. Saving the document will not automatically update the field; you must either update all fields, or print preview the document in order to make the field display the actual filename.
    Post 718738 contains a macro that you can run to update all fields in a document. You could call this from your SaveAsNewFile macro.

    BTW the SaveAsNewFile macro could be simplified to

    Code:
    Sub SaveAsNewFile()
      Application.Dialogs(wdDialogFileSaveAs).Show
    End Sub

  5. #5
    Lounger
    Join Date
    Feb 2005
    Location
    Florida, USA
    Posts
    38
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi Hans,

    << - why would you have to delete a file Document1.doc, as you originally mentioned? I don't understand where Document1.doc comes from. >>

    Forget it, I goofed and it was my wrong doing.

    Regarding the updating the field, I got it and will follow your suggestions

    I appreciate your insights and helpfull assistance, Thanks!

    -Tivoli0

Posting Permissions

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